Java的面向对象编程外文资料翻译
Java编程语言外文翻译、英汉互译、中英对照
文档从互联网中收集,已重新修正排版,word格式支持编辑,如有帮助欢迎下载支持。
外文翻译原文及译文学院计算机学院专业计算机科学与技术班级学号姓名指导教师负责教师Java(programming language)Java is a general-purpose, concurrent, class-based, object-oriented computer program- -ming language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to byte code (class file) that can run on any Java virtual machine(JVM) regardless of computer architecture. Java is, as of 2012, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 10 million users. Java was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.The original and reference implementation Java compilers, virtual machines, and class libraries were developed by Sun from 1991 and first released in 1995. As of May 2007, in compliance with the specifications of the Java Community Process, Sun relicensed most of its Java technologies under the GNU General Public License. Others have also developed alternative implementations of these Sun technologies, such as the GNU Compiler for Java and GNU Classpath.Java is a set of several computer software products and specifications from Sun Microsystems (which has since merged with Oracle Corporation), that together provide a system for developing application software and deploying it in across-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones on the low end, to enterprise servers and supercomputers on the high end. While less common, Java appletsare sometimes used to provide improved and secure functions while browsing the World Wide Web on desktop computers.Writing in the Java programming language is the primary way to produce code that will be deployed as Java bytecode. There are, however, byte code compilers available forother languages such as Ada, JavaScript, Python, and Ruby. Several new languages have been designed to run natively on the Java Virtual Machine (JVM), such as Scala, Clojure and Groovy.Java syntax borrows heavily from C and C++, but object-oriented features are modeled after Smalltalk and Objective-C. Java eliminates certain low-level constructs such as pointers and has a very simple memory model where every object is allocated on the heap and all variables of object types are references. Memory management is handled through integrated automatic garbage collection performed by the JVM.An edition of the Java platform is the name for a bundle of related programs from Sun that allow for developing and running programs written in the Java programming language. The platform is not specific to any one processor or operating system, but rather an execution engine (called a virtual machine) and a compiler with a set of libraries that are implemented for various hardware and operating systems so that Java programs can run identically on all of them. The Java platform consists of several programs, each of which provides a portion of its overall capabilities. For example, the Java compiler, which converts Java source code into Java byte code (an intermediate language for the JVM), is provided as part of the Java Development Kit (JDK). The Java Runtime Environment(JRE), complementing the JVM with a just-in-time (JIT) compiler, converts intermediate byte code into native machine code on the fly. An extensive set of libraries are also part of the Java platform.The essential components in the platform are the Java language compiler, the libraries, and the runtime environment in which Java intermediate byte code "executes" according to the rules laid out in the virtual machine specification.In most modern operating systems (OSs), a large body of reusable code is provided to simplify the programmer's job. This code is typically provided as a set of dynamically loadable libraries that applications can call at runtime. Because the Java platform is not dependent on any specific operating system, applications cannot rely on any of the pre-existing OS libraries. Instead, the Java platform provides a comprehensive set of its own standard class libraries containing much of the same reusable functions commonly found in modern operating systems. Most of the system library is also written in Java. For instance, Swing library paints the user interface and handles the events itself, eliminatingmany subtle differences between how different platforms handle even similar components.The Java class libraries serve three purposes within the Java platform. First, like other standard code libraries, the Java libraries provide the programmer a well-known set of functions to perform common tasks, such as maintaining lists of items or performing complex string parsing. Second, the class libraries provide an abstract interface to tasks that would normally depend heavily on the hardware and operating system. Tasks such as network access and file access are often heavily intertwined with the distinctive implementations of each platform. The and java.io libraries implement an abstraction layer in native OS code, then provide a standard interface for the Java applications to perform those tasks. Finally, when some underlying platform does not support all of the features a Java application expects, the class libraries work to gracefully handle the absent components, either by emulation to provide a substitute, or at least by providing a consistent way to check for the presence of a specific feature.The success of Java and its write once, run anywhere concept has led to other similar efforts, notably the .NET Framework, appearing since 2002, which incorporates many of the successful aspects of Java. .NET in its complete form (Microsoft's implementation) is currently only fully available on Windows platforms, whereas Java is fully available on many platforms. .NET was built from the ground-up to support multiple programming languages, while the Java platform was initially built to support only the Java language, although many other languages have been made for JVM since..NET includes a Java-like language called Visual J# (formerly named J++) that is incompatible with the Java specification, and the associated class library mostly dates to the old JDK 1.1 version of the language. For these reasons, it is more a transitional language to switch from Java to the .NET platform, than a first class .NET language. Visual J# was discontinued with the release of Microsoft Visual Studio 2008. The existing version shipping with Visual Studio 2005will be supported until 2015 as per the product life-cycle strategy.In June and July 1994, after three days of brainstorming with John Gage, the Director of Science for Sun, Gosling, Joy, Naughton, Wayne Rosing, and Eric Schmidt, the team re-targeted the platform for the World Wide Web. They felt that with the advent of graphical web browsers like Mosaic, the Internet was on its way to evolving into the samehighly interactive medium that they had envisioned for cable TV. As a prototype, Naughton wrote a small browser, Web Runner (named after the movie Blade Runner), later renamed Hot Java.That year, the language was renamed Java after a trademark search revealed that Oak was used by Oak Technology. Although Java 1.0a was available for download in 1994, the first public release of Java was 1.0a2 with the Hot Java browser on May 23, 1995, announced by Gage at the Sun World conference. His announcement was accompanied by a surprise announcement by Marc Andreessen, Executive Vice President of Netscape Communications Corporation, that Netscape browsers would be including Java support. On January 9, 1996, the Java Soft group was formed by Sun Microsystems to develop the technology.Java编程语言Java是一种通用的,并发的,基于类的并且是面向对象的计算机编程语言,它是为实现尽可能地减少执行的依赖关系而特别设计的。
java英汉互译
java英汉互译Java是一种广泛使用的编程语言,它是一种面向对象的语言,最初由Sun Microsystems开发。
Java的设计目标是让开发者编写一次代码,然后可以在不同的平台上运行,这种特性被称为“一次编写,到处运行”。
Java的语法与C++类似,但是Java具有更强的安全性和可移植性。
Java的英汉互译是Java English-Chinese Translation,它是指将Java程序中的英文单词翻译成中文,或将中文翻译成英文。
Java英汉互译在软件开发中非常重要,因为Java程序中的注释、变量名、方法名等都需要进行翻译,以便程序员能够更好地理解和维护代码。
Java英汉互译的实现方式有多种,其中最常用的是使用翻译工具或翻译软件。
这些工具可以自动将Java程序中的英文单词翻译成中文,或将中文翻译成英文。
翻译工具的优点是速度快、准确度高,但是由于语言的复杂性,翻译工具有时会出现错误或不准确的翻译结果。
除了翻译工具,Java程序员还可以使用在线翻译网站或翻译软件进行英汉互译。
这些工具可以帮助程序员快速翻译Java程序中的英文单词,但是需要注意的是,翻译结果需要进行人工校对,以确保翻译的准确性和可读性。
在进行Java英汉互译时,程序员需要注意以下几点:1. 翻译结果需要符合语法规范,以便程序能够正常运行。
2. 翻译结果需要准确无误,以避免程序出现错误或漏洞。
3. 翻译结果需要易于理解和维护,以便程序员能够快速定位和修复问题。
总之,Java英汉互译是Java程序员必备的技能之一,它可以帮助程序员更好地理解和维护代码,提高程序的可读性和可维护性。
在进行翻译时,程序员需要注意翻译结果的准确性和可读性,以确保程序的正常运行和稳定性。
Java语言与面向对象思想翻译(中英文)
Java语言与面向对象思想翻译(中英文)Java语言与面向对象思想Java,是由Sun Microsystems公司于1995年5月推出的Java程序设计语言和Java的总称。
用Java实现的Hot Java 浏览器(支持Java applet)显示了Java的魅力:跨平台、动态的Web、Internet计算。
从此,Java被广泛接受并推动了Web的迅速发展,常用的浏览器现在均支持Java applet。
1 Java语言的特点Java语言适用于Internet环境,是一种被广泛使用的网络编程语言,它具有如下的一些特点: 简单Java语言的语法规则和C++类似,但Java语言取消了指针和多重继承,统一使用引用来指示对象(C++中有两种形式,实际上是两种产生对象的途径,而Java 中只有一种),通过自动垃圾收集免去了程序设计人员对于内存块的释放工作。
面向对象(近于完全)Java语言为了提高效率,定义了几个基本的数据类型以非类的方式实现,余下的所有数据类型都以类的形式进行封装,程序系统的构成单位也是类。
因而几乎可以认为是完全面向对象。
平台无关性(可移植、跨平台)Java虚拟机(JVM)是在各种体系结构真实机器中用软件模拟实现的一种想象机器,必要时候可以用硬件实现。
当然,这些虚拟机内部实现各异,但其功能是一致的——执行统一的Java虚拟机指令。
Java编译器将Java 应用程序的源代码文件(.java)翻译成Java字节码文件(.class),它是由Java虚拟机指令构成的。
由于是虚拟机器,因而Java虚拟机执行Java程序的过程一般称为解释。
依赖于虚拟机技术,Java语言具有与机器体系结构无关的特性,即Java程序一旦编写好之后,不需进行修改就可以移植到任何一台体系结构不同的机器上。
从操作系统的角度看,执行一次Java程序的过程就是执行一次Java 虚拟机进程的过程。
面向网络编程Java语言产生之初就面向网络,在JDK中包括了支持TCP/IP、HTTP和FTP等协议的类库。
JAVA外文资料翻译
doc文ห้องสมุดไป่ตู้可能在WAP端浏览体验不佳。建议您优先选择TXT,或下载源文件到本机查看。
外文文献原文及翻译 作 者:辛明 生物医学工程学院影像工程专业 生物医学工程学院信息技术系 指导老师:杨谊
Parsing Java Abstraction of the Difference Between Classes and Interfaces In Java language, abstract scale-up and with support class abstraction definition of two mechanisms. Because of these two kinds of mechanism of existence, just gives Java powerful object-oriented skills. Abstract scale-up and with between class abstraction definition for support has great similarities, even interchangeable, so many developers into line nonabstract class definition for abstract scale-up and it is becoming more casual with choice. In fact, both between still has the very big difference, for their choice even reflected in problem domain essence of understanding, to design the intentions of the understand correctly and reasonable. This paper will for the difference analysis, trying to give a developer with a choice between them are based. Understand class abstraction Abstract class and interface in Java language is used for abstract classes (in this article nonabstract class not from abstract scale-up translation, it represents an abstract body, and abstract scale-up for Java language used to define class abstraction in one way, please readers distinguish) defined, then what are the abstract classes, use abstract classes for us any good? In object-oriented concept, we know all objects is through class to describe, but in turn not such. Not all classes are used to describe object, if a class does not contain enough information to portray a concrete object, this class is abstract classes. Abstract classes are often used to characterization of problem field in our analysis, design that the abstract concepts, is to the series will look different, but essentially the same exact conception of abstraction. For example: if we carry out a graphical editing software development, will find problem domain exists round, triangle so some specific concept, they are different, but they all belong to shape such a concept, shape this concept in problem domain is not exist, it is an abstract concept. Precisely because the abstract concepts in problem field no corresponding specific concept, so to characterization abstract concepts nonabstract class cannot be instantiated. In an object-oriented field, mainly used for class abstraction types hidden. We can construct a fixed a group of behavior of abstract description, but this group of behavior but can have any a possible concrete implementation. This abstract describe is abstract classes, and this an arbitrary a possible concrete realization is behaved for all possible derived class. Modules can be operating an abstract body. Due to the module dependent on a fixed abstraction body, so it can are not allowed to modify, Meanwhile, through the abstract derived from the body, also can expand the behavior of this module function. Familiar with OCP readers must know, object-oriented design to be able to achieve a core principles OCP (Open - Closed flying), class abstraction is one of the key. From the perspectives of grammar definition abstract class and interface
JAVA外文文献+翻译
Java and the InternetIf Java is, in fact, yet another computer programming language, you may question why it is so important and why it is being promoted as a revolutionary step in computer programming. The answer isn’t immediately obvious if you’re coming from a traditional programming perspective. Although Java is very useful for solving traditional stand-alone programming problems, it is also important because it will solve programming problems on the World Wide Web.1.Client-side programmingThe Web’s initial server-browser design provided for interactive content, but the interactivity was completely provided by the server. The server produced static pages for the client browser, which would simply interpret and display them. Basic HTML contains simple mechanisms for data gathering: text-entry boxes, check boxes, radio boxes, lists and drop-down lists, as well as a button that can only be programmed to reset the data on the form or “submit” the data on the form back to the server. This submission passes through the Common Gateway Interface (CGI) provided on all Web servers. The text within the submission tells CGI what to do with it. The most common action is to run a program located on the server in a directory that’s typically called “cgi-bin.” (If you watch the address window at the top of your browser when you push a button on a Web page, you can sometimes see “cgi-bin” within all the gobbledygook there.) These programs can be written in most languages. Perl is acommon choice because it is designed for text manipulation and is interpreted, so it can be installed on any server regardless of processor or operating system. Many powerful Web sites today are built strictly on CGI, and you can in fact do nearly anything with it. However, Web sites built on CGI programs can rapidly become overly complicated to maintain, and there is also the problem of response time. The response of a CGI program depends on how much data must be sent, as well as the load on both the server and the Internet. (On top of this, starting a CGI program tends to be slow.) The initial designers of the Web did not foresee how rapidly this bandwidth would be exhausted for the kinds of applications people developed. For example, any sort of dynamic graphing is nearly impossible to perform with consistency because a GIF file must be created and moved from the server to the client for each version of the graph. And you’ve no doubt had direct experience with something as simple as validating the data on an input form. You press the submit button on a page; the data is shipped back to the server; the server starts a CGI program that discovers an error, formats an HTML page informing you of the error, and then sends the page back to you; you must then back up a page and try again. Not only is this slow, it’s inelegant.The solution is client-side programming. Most machines that run Web browsers are powerful engines capable of doing vast work, and with the original static HTML approach they are sitting there, just idly waiting for the server to dish up the next page. Client-side programming means that the Web browser is harnessed to do whatever work it can, and the result for the user is a much speedier and more interactive experience at your Web site.The problem with discussions of client-side programming is that they aren’t very different from discussions of programming in general. The parameters are almost the same, but the platform is different: a Web browser is like a limited operating system. In the end, you must still program, and this accounts for the dizzying array of problems and solutions produced by client-side programming. The rest of this section provides an overview of the issues and approaches in client-side programming.2.Plug-insOne of the most significant steps forward in client-side programming is the development of the plug-in. This is a way for a programmer to add new functionality to the browser by downloading a piece of code that plugs itself into the appropriate spot in the browser. It tells the browser “from now on you can perform this new activity.” (You ne ed to download the plug-in only once.) Some fast and powerful behavior is added to browsers via plug-ins, but writing a plug-in is not a trivial task, and isn’t something you’d want to do as part of the process of building a particular site. The value of the plug-in for client-side programming is that it allows an expert programmer to develop a new language and add that language to a browser without the permission of the browser manufacturer. Thus, plug-ins provide a “back door” that allows the creation of new client-side programming languages (although not all languages are implemented as plug-ins).3.Scripting languagesPlug-ins resulted in an explosion of scripting languages. With a scripting language you embed the source code for your client-side program directly into the HTML page, and the plug-in that interprets that language is automatically activated while the HTML page is being displayed. Scripting languages tend to be reasonably easy to understand and, because they are simply text that is part of an HTML page, they load very quickly as part of the single server hit required to procure that page. The trade-off is that your code is exposed for everyone to see (and steal). Generally, however, you aren’t doing amazingly sophisticated things with scripting languages so this is not too much of a hardship.This points out that the scripting languages used inside Web browsers are really intended to solve specific types of problems, primarily the creation of richer and more interactive graphical user interfaces (GUIs). However, a scripting language might solve 80 percent of the problems encountered in client-side programming. Your problems might very well fit completely withinthat 80 percent, and since scripting languages can allow easier and faster development, you should probably consider a scripting language before looking at a more involved solution such as Java or ActiveX programming.The most commonly discussed browser scripting languages are JavaScript (which has nothing to do with Java; it’s named that way just to grab some of Java’s marketing momentum), VBScript (which looks like Visual Basic), and Tcl/Tk, which comes from the popular cross-platform GUI-building language. There are others out there, and no doubt more in development.JavaScript is probably the most commonly supported. It comes built into both Netscape Navigator and the Microsoft Internet Explorer (IE). In addition, there are probably more JavaScript books available than there are for the other browser languages, and some tools automatically create pages using JavaScript. However, if you’re already fluent in Visual Basic or Tcl/Tk, you’ll be more productive using those scripting languages rather than learning a new one. (You’ll have your hands full dealing with the Web issues already.)4.JavaIf a scripting language can solve 80 percent of the client-side programming problems, what about the other 20 percent—the “really hard stuff?” The most popular solution today is Java. Not only is it a powerful programming language built to be secure, cross-platform, and international, but Java is being continually extended to provide language features and libraries that elegantly handle problems that are difficult in traditional programming languages, such as multithreading, database access, network programming, and distributed computing. Java allows client-side programming via the applet.An applet is a mini-program that will run only under a Web browser. The applet is downloaded automatically as part of a Web page (just as, for example, a graphic is automatically downloaded). When the applet is activated it executes a program. This is part of its beauty—it provides you with a way to automatically distribute the client software from the server at the time the user needs the client software, and no sooner. The user gets the latest version of the client software without fail and without difficult reinstallation. Because of theway Java is designed, the programmer needs to create only a single program, and that program automatically works with all computers that have browsers with built-in Java interpreters. (This safely includes the vast majority of machines.) Since Java is a full-fledged programming language, you can do as much work as possible on the client before and after making requests of the server. F or example, you won’t need to send a request form across the Internet to discover that you’ve gotten a date or some other parameter wrong, and your client computer can quickly do the work of plotting data instead of waiting for the server to make a plot and ship a graphic image back to you. Not only do you get the immediate win of speed and responsiveness, but the general network traffic and load on servers can be reduced, preventing the entire Internet from slowing down.One advantage a Java applet has ove r a scripted program is that it’s in compiled form, so the source code isn’t available to the client. On the other hand, a Java applet can be decompiled without too much trouble, but hiding your code is often not an important issue. Two other factors can be important. As you will see later in this book, a compiled Java applet can comprise many modules and take multiple server “hits” (accesses) to download. (In Java 1.1 and higher this is minimized by Java archives, called JAR files, that allow all the required modules to be packaged together and compressed for a single download.) A scripted program will just be integrated into the Web page as part of its text (and will generally be smaller and reduce server hits). This could be important to the responsiveness of your Web site. Another factor is the all-important learning curve. Regardless of what you’ve heard, Java is not a trivial language to learn. If you’re a Visual Basic programmer, moving to VBScript will be your fastest solution, and since it will probably solve most typical client/server problems you might be hard pressed to justify learning Java. If you’re experienced with a scripting language you will certainly benefit from looking at JavaScript or VBScript before committing to Java, since they might fit your needs handily and you’ll be more productive sooner.to run its applets withi5.ActiveXTo some degree, the competitor to Java is Microsoft’s ActiveX, although it takes a completely different approach. ActiveX was originally a Windows-only solution, although it is now being developed via an independent consortium to become cross-platform. Effectively, ActiveX says “if your program connects to its environment just so, it can be dropped into a Web page and run under a browser that supports ActiveX.” (I E directly supports ActiveX and Netscape does so using a plug-in.) Thus, ActiveX does not constrain you to a particular language. If, for example, you’re already an experienced Windows programmer using a language such as C++, Visual Basic, or Borland’s Del phi, you can create ActiveX components with almost no changes to your programming knowledge. ActiveX also provides a path for the use of legacy code in your Web pages.6.SecurityAutomatically downloading and running programs across the Internet can sound like a virus-builder’s dream. ActiveX especially brings up the thorny issue of security in client-side programming. If you click on a Web site, you might automatically download any number of things along with the HTML page: GIF files, script code, compiled Java code, and ActiveX components. Some of these are benign; GIF files can’t do any harm, and scripting languages are generally limited in what they can do. Java was also designed to run its applets within a “sandbox” of safety, which prevents it from wri ting to disk or accessing memory outside the sandbox.ActiveX is at the opposite end of the spectrum. Programming with ActiveX is like programming Windows—you can do anything you want. So if you click on a page that downloads an ActiveX component, that component might cause damage to the files on your disk. Of course, programs that you load onto your computer that are not restricted to running inside a Web browser can do the same thing. Viruses downloaded from Bulletin-Board Systems (BBSs) have long been a problem, but the speed of the Internet amplifies the difficulty.The solution seems to be “digital signatures,” whereby code is verified to show who the author is. This is based on the idea that a virus works because its creator can be anonymous, so if you remove the anonymity individuals will be forced to be responsible for their actions. This seems like a good plan because it allows programs to be much more functional, and I suspect it will eliminate malicious mischief. If, however, a program has an unintentional destructive bug it will still cause problems.The Java approach is to prevent these problems from occurring, via the sandbox. The Java interpreter that lives on your local Web browser examines the applet for any untoward instructions as the applet is being loaded. In particular, the applet cannot write files to disk or erase files (one of the mainstays of viruses). Applets are generally considered to be safe, and since this is essential for reliable client/server systems, any bugs in the Java language that allow viruses are rapidly repaired. (It’s worth noting that the browser software actually enforces these security restrictions, and some browsers allow you to select different security levels to provide varying degrees of access to your system.) You might be skeptical of this rather draconian restriction against writing files to your local disk. For example, you may want to build a local database or save data for later use offline. The initial vision seemed to be that eventually everyone would get online to do anything important, but that was soon seen to be impractical (although low-cost “Internet appliances” might someday satisfy the needs of a significant segment of users). The solution is the “signed applet” that uses public-key encryption to verify that an applet does indeed come from where it claims it does. A signed applet can still trash your disk, but the theory is that since you can now hold the applet creator accountable they won’t do vicious things. Java provides a framework for digital signatures so that you will eventually be able to allow an applet to step outside the sandbox if necessary. Digital signatures have missed an important issue, which is the speed that people move around on the Internet. If you download a buggy program and it does something untoward, how long will it be before you discover the damage? It could be days or even weeks. By then, how will you track down the program that’s done it? And what good will it do you at that point?7.Internet vs. intranetThe Web is the most general solution to the client/server problem, so it makes sense that you can use the same technology to solve a subset of the problem, in particular the classic client/server problem within a company. With traditional client/server approaches you have the problem of multiple types of client computers, as well as the difficulty of installing new client software, both of which are handily solved with Web browsers and client-side programming. When Web technology is used for an information network that is restricted to a particular company, it is referred to as an intranet. Intranets provide much greater security than the Internet, since you can physically control access to the servers within your company. In terms of training, it seems that once people und erstand the general concept of a browser it’s much easier for them to deal with differences in the way pages and applets look, so the learning curve for new kinds of systems seems to be reduced.The security problem brings us to one of the divisions that seems to be automatically forming in the world of client-side programming. If your program is running on the Internet, you don’t know what platform it will be working under, and you want to be extra careful that you don’t disseminate buggy code. You need something cross-platform and secure, like a scripting language or Java.If you’re running on an intranet, you might have a different set of constraints. It’s not uncommon that your machines could all be Intel/Windows platforms. On an intranet, you’re respon sible for the quality of your own code and can repair bugs when they’re discovered. In addition, you might already have a body of legacy code that you’ve been using in a more traditional client/server approach, whereby you must physically install client programs every time you do an upgrade. The time wasted in installing upgrades is the most compelling reason to move to browsers, because upgrades are invisible and automatic. If you are involved in such an intranet, the most sensible approach to take is the shortest path that allows you to use your existing code base, rather than trying to recode your programs in a new language.When faced with this bewildering array of solutions to the client-side programming problem, the best plan of attack is a cost-benefit analysis. Consider the constraints of your problem and what would be the shortest path to your solution. Since client-side programming is still programming, it’s always a good idea to take the fastest development approach for your particular situation. This is an aggressive stance to prepare for inevitable encounters with the problems of program development.8.Server-side programmingThis whole discussion has ignored the issue of server-side programming. What happens when you make a request of a server? Most of the time the request is simply “send me this file.” Your browser then interprets the file in some appropriate fashion: as an HTML page, a graphic image, a Java applet, a script program, etc. A more complicated request to a server generally involves a database transaction. A common scenario involves a request for a complex database search, which the server then formats into an HTML page and sends to you as the result. (Of course, if the client has more intelligence via Java or a scripting language, the raw data can be sent and formatted at the client end, which will be faster and less load on the server.) Or you might want to register your name in a database when you join a group or place an order, which will involve changes to that database. These database requests must be processed via some code on the server side, which is generally referred to as server-side programming. Traditionally, server-side programming has been performed using Perl and CGI scripts, but more sophisticated systems have been appearing. These include Java-based Web servers that allow you to perform all your server-side programming in Java by writing what are called servlets. Servlets and their offspring, JSPs, are two of the most compelling reasons that companies who develop Web sites are moving to Java, especially because they eliminate the problems of dealing with differently abled browsers.9. separate arena: applicationsMuch of the brouhaha over Java has been over applets. Java is actually a general-purpose programming language that can solve any type of problem—at least in theory. And as pointed out previously, there might be more effective ways to solve most client/server problems. When you move out of the applet arena (and simultaneously release the restrictions, such as the one against writing to disk) you enter the world of general-purpose applications that run standalone, without a Web browser, just like any ordinary program does. Here, Java’s strength is not only in its portability, but also its programmability. As you’l l see throughout this book, Java has many features that allow you to create robust programs in a shorter period than with previous programming languages. Be aware that this is a mixed blessing. You pay for the improvements through slower execution speed (although there is significant work going on in this area—JDK 1.3, in particular, introduces the so-called “hotspot” performance improvements). Like any language, Java has built-in limitations that might make it inappropriate to solve certain types of programming problems. Java is a rapidly evolving language, however, and as each new release comes out it becomes more and more attractive for solving larger sets of problems.Java和因特网既然Java不过另一种类型的程序设计语言,大家可能会奇怪它为什么值得如此重视,为什么还有这么多的人认为它是计算机程序设计的一个里程碑呢?如果您来自一个传统的程序设计背景,那么答案在刚开始的时候并不是很明显。
面向对象编程3000字英文原文及中文翻译
英文文摘Why has object-oriented programming had such a sweeping impact on the software development community?Object-oriented programming appeals at multiple levels. For managers, it promises faster and cheaper development and maintenance. For analysts and designers, the modeling process becomes simpler and produces a clear, manageable design. For programmers, the elegance and clarity of the object model and the power ofobject-oriented tools and libraries makes programming a much more pleasant task, and programmers experience an increase in productivity. Everybody wins, it would seem.If there’s a downside, it is the expense of the learning curve. Thinking in objects is a dramatic departure from thinking procedurally, and the process of designing objects is much more challenging than procedural design, especially if you’re trying to create reusable objects.In the past, a novice practitioner of object-oriented programming was faced with a choice between two daunting tasks:1.Choose a language such as Smalltalk in which you had to learn a large librarybefore becoming productive.2.Choose C++ with virtually no libraries at all,and struggle through the depthsof the language in order to write your own libraries of objects.It is, in fact, difficult to design objects well –for that matter, it’s hard to design anything well. But the intent is that a relatively few experts design the best objects for others to consume. Successful OOP languages incorporate not just language syntax and a compiler, but an entire development environment including a significant library of well-designed, easy to use objects. Thus, the primary job of most programmers is to use existing objects to solve their application problems. The goal of this chapter is to show you what object-oriented programming is and how simple it can be.This chapter will introduce many of the ideas of Java and object-oriented programming on a conceptual level, but keep in mind that you’re not expected to be able to write full-fledged Java programs after reading this chapter. All the detailed descriptions and examples will follow throughout the course of this book.The progress of abstractionAll programming languages provide abstractions. It can be argued that the complexity of the problems you can solve is directly related to the kind and quality of abstraction. By “kind” I mean: what is it that you are abstracting? Assembly language is a small abstraction of the underlying machine. Many so-called “imperative” languages thatfollowed (such as FORTRAN, BASIC, and C) were abstractions of assembly language. These languages are big improvements over assembly language, but their primary abstraction still requires you to think in terms of the structure of the computer rather than the structure of the problem you are trying to solve. The programmer must establish the association between the machine model (in the “solution space”) and the model of the problem that is actually being solved (in the “problem space”). The effort required to perform this mapping, and the fact that it is extrinsic to the programming language, produces programs that are difficult to write and expensive to maintain, and as a side effect created the entire “programming methods” industry. The alternative to modeling the machine is to model the problem you’re trying to solve. Early languages such as LISP and APL chose particular views of the world (“all problems are ultimately lists” or “all problems are algorithmic”). PROLOG casts all problems into chains of decisions. Languages have been created forconstraint-based programming and for programming exclusively by manipulating graphical symbols. (The latter proved to be too restrictive.) Each of these approaches is a good solution to the particular class of problem they’re designed to solve, but when you step outside of that domain they become awkward.The object-oriented approach takes a step farther by providing tools for the programmer to represent elements in the problem space. This representation is general enough that the programmer is not constrained to any particular type of problem. We refer to the elements in the problem space and their representations in the solution space as “objects.” (Of course, you will also need other objects that don’t have problem-space analogs.) The idea is that the program is allowed to adapt itself to the lingo of the problem by adding new types of objects, so when you read the code describing the solution, you’re reading words that also express the problem. This is a more flexible and powerful l anguage abstraction than what we’ve had before. Thus OOP allows you to describe the problem in terms of the problem, rather than in the terms of the solution. There’s still a connection back to the computer, though. Each object looks quite a bit like a little computer; it has a state, and it has operations you can ask it to perform. However, this doesn’t seem like such a bad analogy to objects in the real world; they all have characteristics and behaviors.译文为什么面向对象的编程会在软件开发领域造成如此震憾的影响?面向对象编程具有多方面的吸引力。
java毕业设计外文文献原文及译文
毕业设计说明书英文文献及中文翻译学学 院:专指导教师:2014 年 6 月软件学院 软件工程Thinking in JavaAlthough it is based on C++, Java is more of a “pure” object-oriented C++ and Java are hybrid languages, but in Java the designers felt that the hybridization was not as important as it was in C++. A hybrid language allows multiple programming styles; the reason C++ is hybrid is to support backward compatibility with the C language. Because C++ is a superset of the C language, it includes many of that language’s undesirable features, which can make some aspects of C++ overly complicated. The Java language assumes that you want to do only object-oriented programming. This means that before you can begin you must shift your mindset into an object-oriented world (unless it’s already there). The benefit of this initial effort is the ability to program in a language that is simpler to learn and to use than many other OOP languages. In this chapter we’ll see the basic components of a Java program and we’ll learn that everything in Java is an object, even a Java program.Each programming language has its own means of manipulating data. Sometimes the programmer must be constantly aware of what type of manipulation is going on. Are you manipulating the object directly, or are you dealing with some kind of indirect representation (a pointer in C or C++) that must be treated with a special syntax?All this is simplified in Java. You treat everything as an object, using a single consistent syntax. Although you treat everything as an object, the identifier you manipulate is actually a “reference” to an object. You might imagine this scene as a television (the object) with your remote control (the reference). As long as you’re holding this reference, you have a connection to the television, but when someone says “change the channel” or “lower the volume,” what you’re manipulating is the reference, which in turn modifies the object. If you want to move around the room and still control the television, you take the remote/reference with you, not the television.Also, the remote control can stand on its own, with no television. That is, just because you have a reference doesn’t mean there’s necessarily an object connected to it. So if you want to hold a word or sentence, you create a String reference:But here you’ve created only the reference, not an object. If you decided to send a message to s at this point, you’ll get an error (at run time) because s isn’t actually attached to anything (there’s no television). A safer practice, then, is always to initialize a reference when you create it.However, this uses a special Java feature: strings can be initialized with quoted text. Normally, you must use a more general type of initialization for objectsWhen you create a reference, you want to connect it with a new object. You do so, in general, with the new keyword. The keyword new says, “Make me a new one of these objects.” So in the preceding example, you can say:Not only does this mean “Make me a new String,” but it also gives information about how to make the String by supplying an initial character string.Of course, String is not the only type that exists. Java comes with a plethora of ready-made types. What’s more important is that you can create your own types. In fact, that’s the fundamental activity in Java programming, and it’s what you’ll b e learning about in the rest of this bookIt’s useful to visualize some aspects of how things are laid out while the program is running—in particular how memory is arranged. There are six different places to store data: Registers. This is the fastest storage because it exists in a place different from that of other storage: inside the processor. However, the number of registers is severely limited, so registers are allocated by the compiler according to its needs. You don’t have direct control, nor do you see any evidence in your programs that registers even exist.The stack. This lives in the general random-access memory (RAM) area, but has direct support from the processor via its stack pointer. The stack pointer is moved down to create new memory and moved up to release that memory. This is an extremely fast and efficient way to allocate storage, second only to registers. The Java compiler must know, while it is creating the program, the exact size and lifetime of all the data that is stored on the stack, because it must generate the code to move the stack pointer up and down. This constraint places limits on the flexibility of your programs, so while some Java storage exists on the stack—in particular, object references—Java objects themselves are not placed on the stack. The heap. This is a general-purpose pool of memory (also in the RAM area) where all Java objects live. The nice thing about the heap is that, unlike the stack, the compiler doesn’t need to know how much storage it needs to allocate from the heap or how long that storage must stay on the heap. Thus, there’s a great deal of flexibility in using storage on the heap. Whenever you need to create an object, you simply write the code to create it by using new, and the storage is allocated on th e heap when that code is executed. Of course there’s a priceyou pay for this flexibility. It takes more time to allocate heap storage than it does to allocate stack storage (if you even could create objects on the stack in Java, as you can in C++). Static storage. “Static” is used here in the sense of “in a fixed location” (although it’s also in RAM). Static storage contains data that is available for the entire time a program is running. You can use the static keyword to specify that a particular element of an object is static, but Java objects themselves are never placed in static storage.Constant storage. Constant values are often placed directly in the program code, which is safe since they can never change. Sometimes constants are cordoned off by themselves so that they can be optionally placed in read-only memory (ROM), in embedded systems.Non-RAM storage. If data lives completely outside a program, it can exist while the program is not running, outside the control of the program. The two primary examples of this are streamed objects, in which objects are turned into streams of bytes, generally to be sent to another machine, and persistent objects, in which the objects are placed on disk so they will hold their state even when the program is terminated. The trick with these types of storage is turning the objects into something that can exist on the other medium, and yet can be resurrected into a regular RAM-based object when necessary. Java provides support for lightweight persistence, and future versions of Java might provide more complete solutions for persistenceOne group of types, which you’ll use quite often in your programming, gets special treatment. You can think of these as “primitive” types. The reason for the special treatment is that to create an object with new—especially a small, simple variable—isn’t very efficient, because new places objects on the heap. For these types Java falls back on the approach taken by C and C++. That is, instead of creating the variable by using new, an “automatic” variable is created that is not a reference. The variable holds the value, and it’s placed on the stack, so it’s much more efficient.Java determines the size of each primitive type. These sizes don’t change from one machine architecture to another as they do in most languages. This size invariance is one reason Java programs are portableJava编程思想“尽管以C++为基础,但Java是一种更纯粹的面向对象程序设计语言”。
java中英文对照
abstra ct 抽象的抽象的abs tract ion 抽象体、抽象物、抽象性抽象体、抽象物、抽象性a ccess存取、取用存取、访问a ccess leve l 存取级别访问级别ac cessfunct ion 存取函式访问函数activ ate 活化激活acti ve 作用中的a dapte r 配接器适配器addr ess 位址地址addr ess s pace位址空间,定址空间addr ess-o f ope rator取址运算子取地址操作符aggre gatio n 聚合algo rithm演算法算法a lloca te 配置分配alloc ator(空间)配置器分配器ap plica tion应用程式应用、应用程序a pplic ation fram ework应用程式框架、应用框架应用程序框架arch itect ure 架构、系统架构体系结构ar gumen t 引数(传给函式的值)。
叁见 para meter叁数、实质叁数、实叁、自变量arr ay 阵列数组arrow oper atorarrow(箭头)运算子箭头操作符assem bly 装配件a ssemb ly la nguag e 组合语言汇编语言as sert(ion)断言a ssign指派、指定、设值、赋值赋值ass ignme nt 指派、指定赋值、分配assi gnmen t ope rator指派(赋值)运算子 = 赋值操作符assoc iated相应的、相关的相关的、关联、相应的asso ciati ve co ntain er 关联式容器(对应 seq uenti al co ntain er)关联式容器atom ic 不可分割的原子的a ttrib ute 属性属性、特性a udio音讯音频A.I. 人工智慧人工智能ba ckgro und 背景背景(用於图形着色)後台(用於行程)b ackwa rd co mpati ble 回溯相容向下兼容bandw idth频宽带宽bas e cla ss 基础类别基类bas e typ e 基础型别 (等同於 bas e cla ss) batch批次(意思是整批作业)批处理be nefit利益收益be st vi ablefunct ion 最佳可行函式最佳可行函式(从 via ble f uncti ons 中挑出的最佳吻合者)bina ry se arch二分搜寻法二分查找bin ary t ree 二元树二叉树bi naryfunct ion 二元函式双叁函数binar y ope rator二元运算子二元操作符b indin g 系结绑定b it 位元位b it fi eld 位元栏位域bit map 位元图位图bit wise以 bit为单元逐一┅b itwis e cop y 以b it 为单元进行复制;位元逐一复制位拷贝bl ock 区块,区段块、区块、语句块boole an 布林值(真假值,true或 fa lse)布尔值borde r 边框、框线边框bra ce(cu rly b race)大括弧、大括号花括弧、花括号br acket(squa re br akcet) 中括弧、中括号方括弧、方括号b reakp oint中断点断点bu ild 建造、构筑、建置(MS用语)buil d-in内建内置bus汇流排总线b usine ss 商务,业务业务bu ttons按钮按钮by te 位元组(由8 bits组成)字节c ache快取高速缓存c all 呼叫、叫用调用c allba ck 回呼回调callopera tor c all(函式呼叫)运算子调用操作符(同 fun ction call oper ator)can didat e fun ction候选函式候选函数(在函式多载决议程序中出现的候选函式)ch ain 串链(例c hainof fu nctio n cal ls)链cha racte r 字元字符check box核取方块(i.e. chec k but ton)复选框check ed ex cepti on 可控式异常(J ava)chec k but ton 方钮 (i.e. ch eck b ox) 复选按钮child clas s 子类别(或称为d erive d cla ss, s ubtyp e)子类cla ss 类别类c lassbody类别本体类体c lassdecla ratio n 类别宣告、类别宣告式类声明cl ass d efini tion类别定义、类别定义式类定义clas s der ivati on li st 类别衍化列类继承列表clas s hea d 类别表头类头clas s hie rarch y 类别继承体系,类别阶层类层次体系cla ss li brary类别程式库、类别库类库class temp late类别模板、类别范本类模板class temp lateparti al sp ecial izati ons 类别模板偏特化类模板部分特化cla ss te mplat e spe ciali zatio ns类别模板特化类模板特化cl eanup清理、善後清理、清除c lient客端、客户端、客户客户clien t-ser ver 主从架构客户/服务器cli pboar d 剪贴簿剪贴板clon e 复制克隆c ollec tion群集集合com bo bo x 复合方块、复合框组合框comm and l ine 命令列命令行(系统文字模式下的整行执行命令)comm unica tion通讯通讯com patib le 相容兼容compi le ti me 编译期编译期、编译时comp iler编译器编译器c ompon ent 组件组件comp ositi on 复合、合成、组合组合comp uter电脑、计算机计算机、电脑conce pt 概念概念concr ete 具象的实在的co ncurr ent 并行并发conf igura tion组态配置con necti on 连接,连线(网络,资料库)连接cons train t 约束(条件)const ruct构件构件con taine r 容器容器(存放资料的某种结构如 list, vec tor...)c ontai nment内含包容co ntext背景关系、周遭环境、上下脉络环境、上下文c ontro l 控制元件、控件控件c onsol e 主控台控制台cons t 常数(const ant 的缩写,C++ 关键字)co nstan t 常数(相对於v ariab le)常量co nstru ctor(ctor)建构式构造函数(与cl ass 同名的一种membe r fun ction s)c opy (v) 复制、拷贝拷贝co py (n) 复件,副本cover涵盖覆盖cr eate创建、建立、产生、生成创建crea tion产生、生成创建curso r 游标光标c ustom订制、自定定制data资料数据da tabas e 资料库数据库data baseschem a 数据库结构纲目data memb er 资料成员、成员变数数据成员、成员变量d ata s truct ure 资料结构数据结构datag ram 资料元数据报文d ead l ock 死结死锁debu g 除错调试d ebugg er 除错器调试器dec larat ion 宣告、宣告式声明deduc tion推导(例:templ ate a rgume nt de ducti on)推导、推断defa ult 预设缺省、默认d efer延缓推迟def ine 定义预定义defi nitio n 定义、定义区、定义式定义del egate委派、委托、委任委托d elega tion(同上)dema rshal反编列散集d erefe rence提领(取出指标所指物体的内容)解叁考der efere nce o perat or de refer ence(提领)运算子 * 解叁考操作符der ivedclass衍生类别派生类desi gn by cont ract契约式设计des ign p atter n 设计范式、设计样式设计模式※最近我比较喜欢「设计范式」一词des troy摧毁、销毁des truct or 解构式析构函数de vice装置、设备设备dialo g 对话窗、对话盒对话框direc tive指令(例:using dire ctive) (编译)指示符dire ctory目录目录di sk 碟盘di spatc h 分派分派d istri buted comp uting分布式计算 (分布式电算)分布式计算分散式计算 (分散式电算)doc ument文件文档do t ope rator dot(句点)运算子 . (圆)点操作符dr iver驱动程式驱动(程序)dy namic bind ing 动态系结动态绑定effic iency效率效率ef ficie nt 高效高效end u ser 终端用户entit y 物体实体、物体enc apsul ation封装封装en closi ng cl ass 外围类别(与巢状类别neste d cla ss 有关)外围类enum (enu merat ion)列举(一种 C++资料型别)枚举enume rator s 列举元(enum型别中的成员)枚举成员、枚举器e qual相等相等equ ality相等性相等性equal ity o perat or eq ualit y(等号)运算子== 等号操作符e quiva lence等价性、等同性、对等性等价性eq uival ent 等价、等同、对等等价esc ape c ode 转义码转义码ev aluat e 评估、求值、核定评估event事件事件e ventdrive n 事件驱动的事件驱动的excep tion异常情况异常e xcept ion d eclar ation异常宣告(ref. C++Prime r 3/e, 11.3)异常声明e xcept ion h andli ng 异常处理、异常处理机制异常处理、异常处理机制ex cepti on sp ecifi catio n 异常规格(ref. C++ Prim er 3/e, 11.4)异常规范exit退离(指离开函式时的那一个执行点)退出exp licit明白的、明显的、显式显式expo rt 汇出引出、导出ex press ion 运算式、算式表达式faci lity设施、设备设施、设备fe ature特性field栏位,资料栏(Ja va)字段, 值域(Java)fi le 档案文件firmw are 韧体固件flag旗标标记fl ash m emory快闪记忆体闪存flex ibili ty 弹性灵活性flus h 清理、扫清刷新fon t 字型字体f orm 表单(pro gramm ing 用语)窗体for mal p arame ter 形式叁数形式叁数forwa rd de clara tion前置宣告前置声明forw ardin g 转呼叫,转发转发fo rward ing f uncti on 转呼叫函式,转发函式转发函数fract al 碎形分形frame work框架框架ful l spe ciali zatio n 全特化(ref. part ial s pecia lizat ion)func tion函式、函数函数funct ion c all o perat or 同callopera tor funct ion o bject函式物件(ref. C++Prime r 3/e, 12.3)函数对象f uncti on ov erloa ded r esolu tion函式多载决议程序函数重载解决(方案)fun ction ality功能、机能功能func tiontempl ate 函式模板、函式范本函数模板funct or 仿函式仿函式、函子game游戏游戏gen erate生成gener ic 泛型、一般化的一般化的、通用的、泛化g eneri c alg orith m 泛型演算法通用算法g etter (相对於 sett er) 取值函式globa l 全域的(对应於local)全局的glo bal o bject全域物件全局对象glo bal s coperesol ution oper ator全域生存空间(范围决议)运算子 ::全局范围解析操作符grou p 群组grou p box群组方块分组框guar d cla use 卫述句 (R efact oring, p250) 卫语句GU I 图形介面图形界面ha nd sh aking握手协商han dle 识别码、识别号、号码牌、权柄句柄ha ndler处理常式处理函数har d-cod ed 编死的硬编码的ha rd-co py 硬拷图屏幕截图ha rd di sk 硬碟硬盘hardw are 硬体硬件hash tabl e 杂凑表哈希表、散列表heade r fil e 表头档、标头档头文件heap堆积堆hier archy阶层体系层次结构(体系)hook挂钩钩子hy perli nk 超链结超链接ico n 图示、图标图标IDE整合开发环境集成开发环境iden tifie r 识别字、识别符号标识符if a nd on ly if若且唯若当且仅当Ill inois伊利诺伊利诺斯imag e 影像图象i mmedi ate b ase 直接的(紧临的)上层baseclass。
java介绍外文翻译
外文原文Introduction to Javaautor:Martin Ngobye.source:Computing Static Slice for Java ProgramsJava is designed to meet the challenges of application development in the context of heterogeneous, network-wide distributed environments. Paramount among these challenges is secure delivery of applications that consume the minimum of system resources, can run on any hardware and software platform, and can be extended dynamically.Java originated as part of a research project to develop advanced software for a wide variety of network devices and embedded systems. The goal was to develop a small, reliable, portable, distributed, real-time operating platform. When the project started, C++ was the language of choice. But over time the difficulties encountered with C++ grew to the point where the problems could best be addressed by creating an entirely new language platform. Design and architecture decisions drew from a variety of languages such as Eiffel, SmallTalk, Objective C, and Cedar/Mesa. The result is a language platform that has proven ideal for developing secure, distributed, network based end-user applications in environments ranging from network-embedded devices to the World-Wide Web and the desktop.The design requirements of Java are driven by the nature of the computing environments in which software must be deployed.The massive growth of the Internet and the World-Wide Web leads us to a completely new way of looking at development and distribution of software. To live in the world of electronic commerce and distribution, Java must enable the development of secure, high performance, and highly robust applications on multiple platforms in heterogeneous, distributed networks.Operating on multiple platforms in heterogeneous networks invalidates the traditional schemes of binary distribution, release, upgrade, patch, and so on. To survive in this jungle, Java must be architecture neutral, portable, and dynamically adaptable.The Java system that emerged to meet these needs is simple, so it can be easily programmed by most developers; familiar, so that current developers can easily learn Java; object oriented, to take advantage of modern software development methodologies and to fit into distributed client-server applications; multithreaded, for high performance in applications that need to perform multiple concurrent activities, such as multimedia; and interpreted, for maximum portability and dynamic capabilities.Together, the above requirements comprise quite a collection of buzzwords, so let’sexamine some of them and their respective benefits before going on.What’s completely new is the manner in which Java and its run-time system have combined them to produce a flexible and powerful programming system..Developing your applications using Java results in software that is portable across multiple machine architectures, operating systems, and graphical user interfaces, secure, and high performance, With Java, your job as a software developer is much easier—you focus your full attention on the end goal of shipping innovative products on time, based on the solid foundation of Java. The better way to develop software is here, now, brought to you by the Java language platform.Very dynamic languages like Lisp, TCL, and SmallTalk are often used for prototyping. One of the reasons for their success at this is that they are very robust—you don’t have to worry about freeing or corrupting memory.Similarly, programmers can be relatively fearless about dealing with memory when programming in Java, The garbage collection sy stem makes the programmer’s job vastly easier; with the burden of memory management taken off the programmer’s shoulders, storage allocation errors go away. Another reason commonly given that languages like Lisp, TCL, and SmallTalk are good for prototyping is that they don’t require you to pin down decisions early on—these languages are semantically rich.Java has exactly the opposite property: it forces you to make explicit choices. Along with these choices come a lot of assistance—you can write method invocations and, if you get something wrong, you get told about it at compile time. You don’t have to worry about method invocation error.The Java beginner must grasp 30 basic conceptsBasic concept1.In OOP the only relations is what the object’s interface, such as the computer seller he leaves alone internal structure of electrical source, but he is only concerned about that whether the power will be supplied to you, also so long as know can or not but is not how and why.All procedures are make up of certain attribute and the behavior object, the different object visit invokes through the function invocation, between the object all intercommunion are invoke through the method invocation, By object data encapsulation, enhances reuse rate very much..2.In OOP the most important thought is class, the class is the template ,is a blueprint, construct an object from a class, namely construct an instance of the class.3. Encapsulation: is that combines the data and the behavior in a package) and hides the data the realization process to the object user, in an object data is called its instance field.4.Through expands a class to obtain a new class is called inheritance, but all classes are constructed by the object super root class of expansion, super root class of as follows can make the introduction.5.Object 3 principal characteristicsBehavior--- explained this object can make what.Tate--- when the object exerts the method object reflection.Dentity--- and other similar behavior objects discrimination symbols.Each object has only indentity and among three characteristics they affect mutually.6. Relations among classes:Use-a:Dependent relationHas-a:Polymerization relationIs-a: inheritor relation -- example:A class has inherited B class, this time A class not only has B class of method, but also has its own method(Individuality exists in general character)7.Structure object use structure:Structure proposing, the structure is one special method, the structure object and to its initialization.Example:A Data class of structure calls DataNew Data () --- structure a new object, also initialize current time.Data happyday=new Data () --- an object evaluates an variable happyday, thus enables this object to be used many times, here be stated the cause variable and the object variable are different.New returns the value is a quotation.Constructor characteristic:The constructor may have 0, one or many parametersThe constructor and the class have the same nameA class may have many constructor. The constructor has not returned valueThe constructor always be together used with the new operator8. Over loading: When many methods have the same name when includes the different parameter, then has the over loading Which method does the compiler have to choose invokes.9.Package : Java allow one or many classes to become together as group, is called package, to organizing duty easily, the standard Java storehouse divides into many packages ng java.Util java, net and so on, the package is layered and all java packages are in java and in a javax package.10. Extendable thought: permit to construct new class on existing classes , when you extend the class which already existed, then you reuse this class of method and the field,at the same time you might add the new method and the field in the new class.11.Expandable class:The expandable class fully manifested is-a to extend the relations The form is:Class (subclass) extends (base class).12. Multi-modality: In java, the object variable is multi-modality But in java does not support multiple extend.13.Dynamic combine: the mechanism of invoking object method mechanism.1) compiler examines object statement type and method name.2) the compiler examines that method invokes parameter type.3) static combine: If the method type is priavte static the final ,compiler can accurately know which method should invoke.4) when the procedure runs and uses dynamic combine to invoke a method, the method edition which then hypothesized machine must invoke x the object actual type which aims at to match.5) dynamic combine: is a very important characteristic, it can cause the procedure to change again may expand but does not need to translate has saved the code.14.Final class:In order to prevent other people derive the new class from yours class, this class is cannot expanded.15.The dynamic invocation spend longer time than the static invocation expenditure.16.Abstract class:Stipulated or many abstract methods class of itself must define is abstract.Example: Public abstract string getDescripition17.In Java each class is be extended by object class.18. equal and toString method in object class .Equal uses in testing an object is whether equal with another object.ToString returns to represent this object the string of character, each class can nearly over loading this method, in order to returns to the current condition the correct expression.(The toString method is a very important method)19.General programming:Any class of type all values all may replace with a object class of variable.20.The array tabulates: The ArrayList dynamic array tabulates, is a class of storehouse, defines in java.In uitl package, but automatic control array size.21.in class and class of object ,getclass method returns to the class type an example, when the procedure start contains can increase in the main method class, hypothesized confidential increase all classes which he needs, each increase class all must increase the classwhich it needs.22.The class: class might dynamic operate the java code for the compilation the procedure to provide the formidable function reflection, this function was JavaBeans is specially useful, the use reflected Java to be able to support the VB programmer to be familiar with the use the tool.procedure of analysis class ability is called the reflector, in Java to provide this function the package to call ng.The reflect reflection mechanism is extremely formidable.1) when run analysis class ability.2) when run searches observes a class of object.3) realizes the general array operation code.4) provides the method object.But this mechanism mainly aims at the tool but not the application and the procedure.In the reflection mechanism most important part is that permits class that you inspect structure. With to API includes:ng.Reflect.Field returns to the field.Java.Reflect.Method returns to the method.ng.Reflect.Constructor returns to the parameter.Method pointer: Java does not have the method pointer, makes a method address another method, may invoke it in behind, but the interface is the better solution.23. interface: should showing class could do what but not to assign how to do, a class may realize one or many interfaces.24.The interface is not a class, but is to conforms to a interface request class of set of standard.If realizes a interface to need 2 steps:1) the statement class needs to realize assigns the interface.2) provides in the interface all methods definition.Stated a class realizes a interface to need to use the implements key wordsClass actionB implements Comparable its actionb needs to provide the CompareTo method, the interface is not the class, cannot use a new example interface.25.A class only then a super class, but a class can realize many interfaces. In a Java important interface: Cloneable26.The interface and call-back :to programs a commonly used pattern is call-back,in the pattern, you may refer when this class of pattern settled specific time occurs returns toadjusts on the object the method.Example:ActionListener interface monitor.Similar API includes:Java.Swing.JOptionPaneJava.Swing.TimerJava.Awt.Tookit27.Object clone:The clone method is a object protection method, this meant your code cannot simple invoke it.28.Inner class an inner class definition is the definition in another class.The reason is:1) an inner class object can visit founds its object realization, including private data.2) about other classes in the same package in that, inner class can be hided.3) the anonymous inner class may the very convenient definition accent.In 4) uses the category to be possible the extremely convenient compilation event driver.29.Agent class (proxy):1) appointing all codes that interfaces request2) all methods (toString equals) that object class define30.Data type:Java is kind of emphasizing type language, each variable all must be declared its types at first, in java altogether has 8 basic types . four kinds are the long, two kinds are the float, one is the char, being used in the Unicode code char, Boolean.1. java is simpleJava and C + + are very similar, but much simpler. All the high-level programming language features, is not absolutely necessary have been deleted. For example, Java does not overload operator, the title of the document, pre-processing, computing pointer, the structure of the joint, multi-dimensional array, templates and implicit type conversion. If you know a little C, C + + or Pascal, you will soon master Java. Here is a simple procedure JavaHelloWorld:publicclassHelloInternet (publicstaticvoidmain (Stringargv []) (System. out. println ( "HelloIn-ternet!")))2. Java is object-orientedJava is an object-oriented programming language. In addition to the simple types,such as digital and Boolean operators in addition, Java is an object of most. As with any object-oriented languages, Java code also organized by category. Each category provides a definition of the object behavior. Another type of succession can be a kind of behavior. In the category of the root level, often the target category. Java support for the single type of inherited hierarchy. This means that each category can only inherit one other category. Some of the language to allow multiple inheritance, but it may cause confusion and unnecessarily complicated language. For example, imagine that an object would inherit two completely different category. Java also supports the kind of summary of the interface. This allows programmers to define the interface methods, and do not have to rush immediately to determine the methods to achieve. A type of interface can be a number of purposes in order to truly multi-inheritance of a number of advantages. The implementation of an object can be any number of interfaces. IDL interface and Java interface very similar. Very easy to set up IDLJ compiler. In other words, Java can be used to create a CORBA object system distributed object system. In the view of many computer systems use IDL interface and CORBA objects, such compatibility is important.3. Java is a type of staticIn a Java program, it is essential to the definition used by the target (number of characters, such as an array) type. This will help programmers quickly found because the procedure when the compiler can detect the type of error. However, Java System objects are also dynamic types. A requirement for the type of dynamic is often possible, so programmers can write the procedures for different types of objects to do different things.4. Is a Java-based compilerWhen running Java programs, which were first compiled into byte code. Byte code is very similar to the machine instructions, so Java program is very efficient. However, the byte code does not specifically for a particular machine, so no need to recompile Java program can be in many different computer implementation. Java source code files were compiled into a category, which is equivalent to process byte code performance. In a Java class file, and an example for all of the variables are in the light of, and for the first time in the implementation of the code be resolved. This makes the code more common and more easily subject to revision, but still high.5. Java is architecture neutralJava language is the same for each computer. For example, simple types are the same: 32-bit integer always, always 64-bit long integers. It is strange, such as C and C + + programming language, and so fashionable it is not the case. As a result of these languages so the definition of freedom, each of the compiler and development environment will bedifferent, so that this process nuisance become a transplant. Java programs can easily gain access to transplants, and there is no need to re-compile.6. Java is a soundJava program can not be caused by the collapse of the computer. Java careful testing of the system memory of each visit, make sure it is legitimate and will not cause any problems. However, even if the Java program may also be wrong. If there is some kind of unexpected things, the process will not collapse, and to abandon the exception. Procedures for such an exception would be found to address them. Traditional computer programs can access the full memory. May (unconsciously) to amend any of the value of memory, which will cause problems. Java program can only access memory to allow them access to those parts of the Java program can not modify it does not seek to change the value.7. Java is a compactAs the Java is designed to run on a small computer, as a programming language for the system is relatively small. It effectively in more than 4MB of RAM to run on PC machine. Java translator occupied by only a few hundred KB. This translator for the Java platform independence and portability is reliable. Due to Java is very small, it is a very small computer memory, such as the Java-based PC, as well as television sets, ovens, telephone and home computer, and so on, it is ideal.8. Java is a multi-threadedJava program can run more than one thread. For example, it can be a thread in a time-consuming to complete the calculation, and other users to interact with the threads of dialogue. Therefore, users do not have to stop working, waiting for the Java computing time-consuming process. In the multi-threaded programming environment, it is often difficult because many things may occur at the same time. However, Java provides easy-to-use features simultaneously, so that the programming easier.中文翻译JA V A介绍作者:Martin Ngobye.出处:Computing Static Slice for Java ProgramsJava是被设计用来解决在上下文分布式的异构网络中应用程序开发的问题。
面向对象编程3000字英文原文及中文翻译
面向对象编程3000字英文原文及中文翻译1.___matic paragraphs:Why has object-oriented programming had such a sweeping impact on the are development community。
Object-oriented programming ___ managers。
___ analysts and designers。
___ produces a clear。
manageable design。
For programmers。
the elegance and clarity of the object model and the power of object-oriented tools and libraries make programming a much more pleasant task。
___ wins。
it would seem.If there’s a downside。
it is the expense of the learning curve。
Thinking in objects is a ___。
and the process of designing objectsis much more challenging than ral design。
especially if you’re trying to create reusable objects.2.Rewriting each paragraph:Object-oriented programming has ___ and maintenance。
while analysts and designers ___ and create clear。
manageable designs。
Programmers can take advantage of the elegance and clarity of the object model。
JAVA编程常用英文单词汇总
Java根底常见英语词汇(共70个)OO: object-oriented ,面向对象OOP: object-oriented programming,面向对象编程JDK:Java development kit, java开发工具包JVM:java virtual machine ,java虚拟机Compile:编绎Run:运行Class:类Object:对象System:系统out:输出print:打印line:行variable:变量type:类型operation:操作,运算array:数组parameter:参数method:方法function:函数member-variable:成员变量member-function:成员函数get:得到set:设置public:公有的private:私有的protected:受保护的default:默认access:访问package:包import:导入static:静态的void:无(返回类型)extends:继承parent class:父类base class:基类super class:超类child class:子类derived class:派生类override:重写,覆盖overload:重载final:最终的,不能改变的abstract:抽象interface:接口implements:实现exception:异常Runtime:运行时ArithmeticException:算术异常ArrayIndexOutOfBoundsException:数组下标越界异常NullPointerException:空引用异常ClassNotFoundException:类没有发现异常NumberFormatException:数字格式异常(字符串不能转化为数字) Catch:捕捉Finally:最后Throw:抛出Throws: (投掷)表示强制异常处理Throwable:(可抛出的)表示所有异常类的祖先类Lang:language,语言Util:工具 Display:显示Random:随机Collection:集合ArrayList:(数组列表)表示动态数组HashMap: 散列表,哈希表Swing:轻巧的Awt:abstract window toolkit:抽象窗口工具包Frame:窗体Size:尺寸Title:标题Add:添加Panel:面板Layout:布局Scroll:滚动Vertical:垂直Horizonatal:水平Label:标签TextField:文本框TextArea:文本域Button:按钮Checkbox:复选框Radiobutton:单项选择按钮Combobox:复选框Event:事件Mouse:鼠标Key:键Focus:焦点Listener:监听Border:边界Flow:流Grid:网格MenuBar:菜单栏Menu:菜单MenuItem:菜单项PopupMenu:弹出菜单Dialog:对话框Message:消息 Icon:图标Tree:树Node:节点Jdbc:java database connectivity, java数据库连接DriverManager:驱动管理器Connection:连接Statement:表示执行对象Preparedstatement:表示预执行对象Resultset:结果集Next:下一个Close:关闭executeQuery:执行查询Jbuilder中常用英文(共33个)File:文件New:新建New Project:新建工程New Class: 新建类New File:新建文件Open project:翻开工程Open file:翻开文件Reopen:重新翻开Close projects:关闭工程Close all except…:除了..全部关闭Rename:重命名Exit:退出View:视图Panes:面板组Project:工程Content:内容Structure:结构Message:消息Source:源文件Bean:豆子Properties:属性Make:编绎Build:编绎Rebuild:重编绎Refresh:刷新Project properties:工程属性Default project properties:默认的工程属性Run:运行Debug:调试Tools:工具Preferences:参数配置Configure:配置Libraries:库JSP中常用英文URL: Universal Resource Location:统一资源定位符IE: Internet Explorer 因特网浏览器Model:模型View:视图C:controller:控制器Tomcat:一种jsp的web效劳器WebModule:web模块Servlet:小效劳程序Request:请求Response:响应Init: initialize,初始化Service:效劳Destroy:销毁Startup:启动Mapping:映射pattern:模式Getparameter:获取参数Session:会话Application:应用程序Context:上下文redirect:重定向dispatch:分发forward:转交setAttribute:设置属性getAttribute:获取属性page:页面contentType:内容类型charset:字符集include:包含tag:标签taglib:标签库EL:expression language,表达式语言Scope:作用域Empty:空JSTL:java standard tag library,java标准标签库TLD:taglib description,标签库描述符Core:核心Test:测试Foreach:表示循环Var:variable,变量Status:状态Items:工程集合Fmt:format,格式化Filter:过滤器报错英文第一章:JDK(Java Development Kit) java开发工具包JVM(Java Virtual Machine) java虚拟机Javac编译命令java解释命令Javadoc生成java文档命令classpath 类路径Version版本author作者public公共的class类static静态的void没有返回值String字符串类System系统类print同行打印println换行打印JIT(just-in-time)及时处理第二章:byte 字节char 字符boolean 布尔short 短整型int 整形long 长整形float 浮点类型double 双精度if 如果else 否那么switch 多路分支case 与常值匹配break 终止default 默认while 当到循环do 直到循环for 次数循环continue结束本次循环进行下次跌代length 获取数组元素个数第三章:OOPobject oriented programming 面向对象编程Object 对象Class 类Class member 类成员Class method类方法Class variable 类变量Constructor 构造方法Package 包Import package 导入包第四章:Extends 继承Base class 基类Super class 超类Overloaded method 重载方法Overridden method 重写方法Public 公有Private 私有Protected 保护Abstract抽象Interface 接口Implements interface 实现接口第五章:Exception 意外,异常RuntimeExcepiton 运行时异常ArithmeticException 算术异常IllegalArgumentException 非法数据异常ArrayIndexOutOfBoundsException 数组索引越界异常NullPointerException 空指针异常ClassNotFoundException 类无法加载异常〔类不能找到〕NumberFormatException 字符串到float类型转换异常〔数字格式异常〕IOException 输入输出异常FileNotFoundException 找不到文件异常EOFException 文件结束异常InterruptedException 〔线程〕中断异常try 尝试catch 捕捉finally 最后throw 投、掷、抛throws 投、掷、抛print Stack Trace() 打印堆栈信息get Message〔〕获得错误消息get Cause〔〕获得异常原因method 方法able 能够instance 实例check 检查第六章:byte〔字节〕char〔字符〕int〔整型〕long〔长整型〕float〔浮点型〕double〔双精度〕boolean〔布尔〕short〔短整型〕Byte 〔字节类〕Character 〔字符类〕Integer〔整型类〕Long 〔长整型类〕Float〔浮点型类〕.Double 〔双精度类〕Boolean〔布尔类〕Short 〔短整型类〕Digit 〔数字〕Letter 〔字母〕Lower (小写)Upper (大写)Space (空格)Identifier (标识符)Start (开始)String (字符串)length 〔值〕equals (等于)Ignore 〔忽略〕compare 〔比拟〕sub 〔提取〕concat 〔连接〕replace 〔替换〕trim 〔整理〕Buffer (缓冲器)reverse (颠倒)delete 〔删除〕append 〔添加〕Interrupted 〔中断的〕第七章:Date 日期,日子After 后来,后面Before 在前,以前Equals 相等,均等toString 转换为字符串SetTime 设置时间Display 显示,展示Calendar 日历Add 添加,增加GetInstance获得实例getTime 获得时间Clear 扫除,去除Clone 克隆,复制Util 工具,龙套Components成分,组成Random 随意,任意Next Int 下一个整数Gaussian 高斯ArrayList 对列.LinkedList链表Hash 无用信息,杂乱信号Map 地图Vector 向量,矢量Size 大小Collection收集Shuffle 混乱,洗牌RemoveFirst移动至开头RemoveLast 移动至最后lastElement最后的元素Capacity 容量,生产量Contains 包含,容纳Search 搜索,查询InsertElementAt 插入元素在某一位置第八章:io->in out 输入/输出File文件import导入exists存在isFile是文件isDirectory 是目录getName获取名字getPath获取路径getAbsolutePath 获取绝对路径lastModified 最后修改日期length长度InputStream 输入流OutputStream 输出流Unicode统一的字符编码标准, 采用双字节对字符进行编码Information 信息FileInputStream 文件输入流FileOutputStream文件输出流IOException 输入输出异常fileobject 文件对象available 可获取的read读取write写BufferedReader 缓冲区读取FileReader 文本文件读取BufferedWriter 缓冲区输出FileWriter 文本文件写出flush清空close关闭DataInputStream 二进制文件读取.DataOutputStream二进制文件写出EOF最后encoding编码Remote远程release释放第九章:JBuiderJava 集成开发环境〔IDE〕Enterprise 企业版Developer 开发版Foundation 根底版Messages 消息格Structure 结构窗格Project工程Files文件Source源代码Design设计History历史Doc文档File文件Edit编辑Search查找Refactor 要素View视图Run运行Tools工具Window窗口Help帮助Vector矢量addElement 添加内容Project Winzard 工程向导Step步骤Title标题Description 描述Copyright 版权Company公司Aptech Limited Aptechauthor 作者Back后退Finish完成version版本Debug调试New新建ErrorInsight 调试第十章:JFrame窗口框架JPanel 面板JScrollPane 滚动面板title 标题Dimension 尺寸Component组件SwingJA V A轻量级组件getContentPane 得到内容面板LayoutManager布局管理器setVerticalScrollBarPolicy设置垂直滚动条策略AWT〔Abstract Window Toolkit〕抽象窗口工具包GUI 〔Graphical User Interface〕图形用户界面VERTICAL_SCROLLEARAS_NEEDED当内容大大面板出现滚动条VERTICAL_SOROLLEARAS_ALWAYS显示滚动条VERTICAL_SOROLLEARAS_NEVER不显示滚动条JLabel标签Icon 图标image图象LEFT 左对齐RIGHT右对齐JTextField单行文本getColumns得到列数setLayout设置布局BorderLayout 边框布局CENTER居中对齐JTextArea多行文本setFont设置字体setHorizontalAlignment设置文本水平对齐方式setDefaultCloseOperation设置默认的关闭操作add增加JButton 按钮JCheckBox 复选框JRadioButton单项选择按钮addItem 增加列表项getItemAt 得到位置的列表项getItemCount 得到列表项个数setRolloverIcon 当鼠标经过的图标setSelectedIcon 中选择按钮的图标getSelectedItem 得到选择的列表项getSelectedIndex 得到选择的索引ActionListener按钮监听ActionEvent 按钮事件actionPerformed按钮单击方法附加.............可能有重复编程英语:(手摘)abstract (关键字) 抽象['?bstr?kt]accessvt.访问,存取['?kses]'(n.入口,使用权)algorithmn.算法['?lg?riem]Annotation[java] 代码注释[?n?u'tei??n]anonymousadj.匿名的[?'n?nim?s]'(反义:directly adv.直接地,立即[di'rektli, dai'rektli]) apply v.应用,适用[?'plai]application n.应用,应用程序[,?pli'kei??n]' (application crash 程序崩溃) arbitrarya.任意的['ɑ:bitr?ri]argument n.参数;争论,论据['ɑ:gjum?nt]'(缩写args)assert (关键字) 断言[?'s?:t] ' (java 1.4 之后成为关键字)associaten.关联(同伴,伙伴) [?'s?u?ieit]attributen.属性(品质,特征) [?'tribju:t]boolean(关键字) 逻辑的, 布尔型call n.v.调用; 呼叫; [k?:l]circumstancen.事件(环境,状况) ['s?:k?mst?ns]crash n.崩溃,破碎[kr??]cohesion 内聚,黏聚,结合[k?u'hi:??n](a class is designed with a single, well-focoused purpose. 应该不止这点)command n. 命令,指令[k?'mɑ:nd](指挥, 控制) (command-line 命令行) Comments [java] 文本注释['k?ments]compile[java] v.编译[k?m'pail]' Compilation n.编辑[,k?mpi'lei??n]const (保存字)constant n. 常量, 常数, 恒量['k?nst?nt]continue (关键字)coupling 耦合,联结['k?pli?]making sure that classes know about other classes only through their APIs.declare[java] 声明[di'kl??]default(关键字) 默认值; 缺省值[di'f?:lt]delimiter定义符; 定界符Encapsulation[java] 封装(hiding implementation details)Exception [java] 例外; 异常[ik'sep??n]entry n.登录项, 输入项, 条目['entri]enum(关键字)execute vt.执行['eksikju:t]exhibit v.显示, 陈列[ig'zibit]exist 存在, 发生[ig'zist] '(SQL关键字exists)extends(关键字) 继承、扩展[ik'stend]false (关键字)final (关键字) finally (关键字)fragments段落; 代码块['fr?gm?nt]FrameWork [java] 结构,框架['freimw?:k]Generic[java] 泛型[d?i'nerik]goto(保存字) 跳转heap n.堆[hi:p]implements(关键字) 实现['implim?nt]import (关键字) 引入(进口,输入)Info n.信息(information [,inf?'mei??n] )Inheritance [java] 继承[in'herit?ns] (遗传,遗产)initialize 预置初始化[i'ni??laiz]instanceof(关键字) 运算符,用于引用变量,以检查这个对象是否是某种类型。
Java技术介绍-毕业论文外文翻译
Java Technical DescriptionJava as a Programming Platform.Java is certainly a good programming language. There is no doubt that it is one of the better languages available to serious programmers. We think it could potentially have been a great programming language, but it is probably too late for that. Once a language is out in the field, the ugly reality of compatibility with existing code sets in."Java was never just a language. There are lots of programming languages out there, and few of them make much of a splash. Java is a whole platform, with a huge library, containing lots of reusable code, and an execution environment that provides services such as security, portability across operating systems, and automatic garbage collection.As a programmer, you will want a language with a pleasant syntax and comprehensible semantics (i.e., not C++). Java fits the bill, as do dozens of other fine languages. Some languages give you portability, garbage collection, and the like, but they don't have much of a library, forcing you to roll your own if you want fancy graphics or networking or database access. Well, Java has everything—a good language, a high-quality execution environment, and a vast library. That combination is what makes Java an irresistible proposition to so many programmers.Features of Java.1.SimpleWe wanted to build a system that could be programmed easily without a lot of esoteric training and which leveraged today's standard practice. So even though we found that C++ was unsuitable, we designed Java as closely to C++ as possible in order to make the system more comprehensible. Java omits many rarely used, poorly understood, confusing features of C++ that, in our experience, bring more grief than benefit.The syntax for Java is, indeed, a cleaned-up version of the syntax for C++. There is no need for header files, pointer arithmetic (or even a pointer syntax), structures, unions, operator overloading, virtual base classes, and so on. (See the C++ notes interspersed throughout the text for more on the differences between Java and C++.) The designers did not, however, attempt to fix all of the clumsy features of C++. For example, the syntax of the switch statement is unchanged in Java. If you know C++, you will find the transition to the Java syntax easy.If you are used to a visual programming environment (such as Visual Basic), you will not find Java simple. There is much strange syntax (though it does not take long to get the hang of it). More important, you must do a lot more programming in Java. The beauty of Visual Basic is that its visual design environment almost automatically provides a lot of the infrastructure for an application. The equivalent functionality must be programmed manually, usually with a fair bit of code, in Java. There are, however, third-party development environments that provide "drag-and-drop"-style program development.Another aspect of being simple is being small. One of the goals of Java is to enable the construction of software that can run stand-alone in small machines. The size of the basic interpreter and class support is about 40K bytes; adding the basic standard libraries and thread support (essentially a self-contained microkernel) adds an additional 175K.2. Object OrientedSimply stated, object-oriented design is a technique for programming that focuses on the data (= objects) and on the interfaces to that object. To make an analogy with carpentry, an "object-oriented" carpenter would be mostly concerned with the chair he was building, and secondarily with the tools used to make it; a "non-object-oriented" carpenter would think primarily of his tools. The object-oriented facilities of Java are essentially those of C++.Object orientation has proven its worth in the last 30 years, and it is inconceivable that a modern programming language would not use it. Indeed, the object-oriented features of Java are comparable to those of C++. The major differencebetween Java and C++ lies in multiple inheritance, which Java has replaced with the simpler concept of interfaces, and in the Java metaclass model. The reflection mechanism and object serialization feature make it much easier to implement persistent objects and GUI builders that can integrate off-the-shelf components.3. DistributedJava has an extensive library of routines for coping with TCP/IP protocols like HTTP and FTP. Java applications can open and access objects across the Net via URLs with the same ease as when accessing a local file system. We have found the networking capabilities of Java to be both strong and easy to use. Anyone who has tried to do Internet programming using another language will revel in how simple Java makes onerous tasks like opening a socket connection. (We cover networking in Volume 2 of this book.) The remote method invocation mechanism enables communication between distributedobjects (also covered in Volume 2).There is now a separate architecture, the Java 2 Enterprise Edition (J2EE), that supports very large scale distributed applications.4. RobustJava is intended for writing programs that must be reliable in a variety of ways. Java puts a lot of emphasis on early checking for possible problems, later dynamic (run-time) checking, and eliminating situations that are error-prone.… The single biggest difference between Java and C/C++ is that Java has a pointer model that eliminates the possibility of overwriting memory and corrupting data.This feature is also very useful. The Java compiler detects many problems that, in other languages, would show up only at run time. As for the second point, anyone who has spent hours chasing memory corruption caused by a pointer bug will be very happy with this feature of Java.If you are coming from a language like Visual Basic that doesn't explicitly use pointers, you are probably wondering why this is so important. C programmers are not so lucky. They need pointers to access strings, arrays, objects, and even files. In Visual Basic, you do not use pointers for any of these entities, nor do you need to worry about memory allocation for them. On the other hand, many data structures aredifficult to implement in a pointerless language. Java gives you the best of both worlds. You do not need pointers for everyday constructs like strings and arrays. You have the power of pointers if you need it, for example, for linked lists. And you always have complete safety, because you can never access a bad pointer, make memory allocation errors, or have to protect against memory leaking away.5. SecureJava is intended to be used in networked/distributed environments. Toward that end, a lot of emphasis has been placed on security. Java enables the construction of virus-free, tamper-free systems.In the first edition of Core Java we said: "Well, one should 'never say never again,'" and we turned out to be right. Not long after the first version of the Java Development Kit was shipped, a group of security experts at Princeton University found subtle bugs in the security features of Java 1.0. Sun Microsystems has encouraged research into Java security, making publicly available the specification and implementation of the virtual machine and the security libraries. They have fixed all known security bugs quickly. In any case, Java makes it extremely difficult to outwit its security mechanisms. The bugs found so far have been very technical and few in number. From the beginning, Java was designed to make certain kinds of attacks impossible, among them:∙Overrunning the runtime stack—a common attack of worms and viruses Corrupting memory outside its own process space Reading or writing files without permission.∙A number of security features have been added to Java over time. Since version1.1, Java has the notion of digitally signed classesWith a signed class, you can be sure who wrote it. Any time you trust the author of the class, the class can be allowed more privileges on your machine.6. Architecture NeutralThe compiler generates an architecture-neutral object file format—the compiled code is executable on many processors, given the presence of the Java runtime system.The Java compiler does this by generating bytecode instructions which have nothing to do with a particular computerarchitecture. Rather, they are designed to be both easy to interpret on any machine and easily translated into native machine code on the fly.This is not a new idea. More than 20 years ago, both Niklaus Wirth's original implementation of Pascal and the UCSD Pascal system used the same technique. Of course, interpreting bytecodes is necessarily slower than running machine instructions at full speed, so it isn't clear that this is even a good idea. However, virtual machines have the option of translating the most frequently executed bytecode sequences into machine code, a process called just-in-time compilation. This strategy has proven so effective that even Microsoft's .NET platform relies on a virtual machine.The virtual machine has other advantages. It increases security because the virtual machine can check the behavior of instruction sequences. Some programs even produce bytecodes on the fly, dynamically enhancing the capabilities of a running program.7. PortableUnlike C and C++, there are no "implementation-dependent" aspects of the specification. The sizes of the primitive data types are specified, as is the behavior of arithmetic on them.For example, an int in Java is always a 32-bit integer. In C/C++, int can mean a 16-bit integer, a 32-bit integer, or any other size that the compiler vendor likes. The only restriction is that the int type must have at least as many bytes as a short int and cannot have more bytes than a long int. Having a fixed size for number types eliminates a major porting headache. Binary data is stored and transmitted in a fixed format, eliminating confusion about byte ordering. Strings are saved in a standard Unicode format.The libraries that are a part of the system define portable interfaces. For example, there is an abstract Window class and implementations of it for UNIX, Windows, and the Macintosh.As anyone who has ever tried knows, it is an effort of heroic proportions to write a program that looks good on Windows, the Macintosh, and 10 flavors of UNIX. Java1.0 made the heroic effort, delivering a simple toolkit that mapped common user interface elements to a number of platforms.Unfortunately, the result was a library that, with a lot of work, could give barely acceptable results on different systems. (And there were often different bugs on the different platform graphics implementations.) But it was a start. There are many applications in which portability is more important than user interface slickness, and these applications did benefit from early versions of Java. By now, the user interface toolkit has been completely rewritten so that it no longer relies on the host user interface. The result is far more consistent and, we think, more attractive than in earlier versions of Java.8. InterpretedThe Java interpreter can execute Java bytecodes directly on any machine to which the interpreter has been ported. Since linking is a more incremental and lightweight process, the development process can be much more rapid and exploratory.Incremental linking has advantages, but its benefit for the development process is clearly overstated. In any case, we have found Java development tools to be quite slow. If you are used to the speed of the classic Microsoft Visual C++ environment, you will likely be disappointed with the performance of Java development environments. (The current version of Visual Studio isn't as zippy as the classic environments, however. No matter what languageyou program in, you should definitely ask your boss for a faster computer to run the latest development environments. )9. High PerformanceWhile the performance of interpreted bytecodes is usually more than adequate, there are situations where higher performance is required. The bytecodes can be translated on the fly (at run time) into machine code for the particular CPU the application is running on.If you use an interpreter to execute the bytecodes, "high performance" is not the term that we would use. However, on many platforms, there is also another form ofcompilation, the just-in-time (JIT) compilers. These work by compiling the bytecodes into native code once, caching the results, and then calling them again if needed. This approach speeds up commonly used code tremendously because one has to do the interpretation only once. Although still slightly slower than a true native code compiler, a just-in-time compiler can give you a 10- or even 20-fold speedup for some programs and will almost always be significantly faster than an interpreter. This technology is being improved continuously and may eventually yield results that cannot be matched by traditional compilation systems. For example, a just-in-time compiler can monitor which code is executed frequently and optimize just that code for speed.10. MultithreadedThe enefits of multithreading are better interactive responsiveness and real-time behavior.if you have ever tried to do multithreading in another language, you will be pleasantly surprised at how easy it is in Java. Threads in Java also can take advantage of multiprocessor systems if the base operating system does so. On the downside, thread implementations on the major platforms differ widely, and Java makes no effort to be platform independent in this regard. Only the code for calling multithreading remains the same across machines; Java offloads the implementation of multithreading to the underlying operating system or a thread library. Nonetheless, the ease of multithreading is one of the main reasons why Java is such an appealing language for server-side development.11. DynamicIn a number of ways, Java is a more dynamic language than C or C++. It was designed to adapt to an evolving environment. Libraries can freely add new methods and instance variables without any effect on their clients. In Java, finding out run time type information is straightforward.This is an important feature in those situations in which code needs to be added to a running program. A prime example is code that is downloaded from the Internet to run in a browser. In Java 1.0, finding out runtime type information was anything but straightforward, but current versions of Java give the programmer full insight intoboth the structure and behavior of its objects. This is extremely useful for systems that need to analyze objects at run time, such as Java GUI builders, smart debuggers, pluggable components, and object databases.Java技术介绍Java是一种程序设计平台Java是一种优秀的程序设计语言。
Java编程语言基础(外文文献翻译)(可编辑)
JavaTM Programming Language BasicsLike applications, applets are created from classes. However, applets do not have a main method as an entry point, but instead, have several methods to control specific aspects of applet execution.This lesson converts an application from Lesson 2 to an applet and describes the structure and elements of an applet.1、Application to Applet2、Run the Applet3、Applet Structure and Elements4、Packages5、More Information1、Application to AppletThe following code is the applet equivalent to the LessonTwoB application from Lesson 2. The figure below shows how the running applet looks. The structure and elements of the applet code are discussed after the section on how to run the applet just below.import et;import hics;import r;public class SimpleApplet extends AppletString text "I'm a simple applet";public void inittext "I'm a simple applet";setBackground Color.cyan ;public void startSytln "starting..." ;public void stopSytln "stopping..." ;public void destroySytln "preparing to unload..." ;public void paint Graphics gSytln "Paint" ;g.setColor Color.blue ;g.drawRect 0, 0,getSize .width -1,getSize .height -1 ;g.setColor Color.red ;g.drawString text, 15, 25 ;The SimpleApplet class is declared public so the program that runs the applet a browser or appletviewer , which is not local to the program can access it.2、Run the AppletTo see the applet in action, you need an 6>HTML file with the Applet tag as follows:APPLET CODE SimpleApplet.class WIDTH 200 HEIGHT 100The easiest way to run the applet is with appletviewer shown below where simpleApplet.html is a file that contains the above HTML code:appletviewer simpleApplet.htmlNote: To run an applet written with JavaTM 2 APIs in a browser, the browser must be enabled for the Java 2 Platform. If your browser is not enabled for the Java 2 Platform, you have to use appletviewer to run the applet or install Java Plug-in. Java Plug-in lets you run applets on web pages under the 1.2 version of the Java VM instead of the web browser's default Java VM.3、Applet Structure and ElementsThe Java API Applet class provides what you need to design the appearance and manage the behavior of an applet. This class provides a graphical user interface GUI component called a Panel and a number of methods. To create an applet, you extend or subclass the Applet class and implement the appearance and behavior you want.The applet's appearance is created by drawing onto the Panel or by attaching other GUI components such as push buttons, scrollbars, or text areas to the Panel. The applet's behavior is defined by implementing the methods.3.1 Extending a ClassMost classes of any complexity extend other classes. To extend another class means to write a new class that can use the fields and methods defined in the class being extended. The class being extended is the parent class, and the class doing the extending is the child class. Another way to say this is the child class inherits the fields and methods of its parent or chain of parents. Child classes either call or override inherited methods. This is called single inheritance.The SimpleApplet class extends Applet class, which extends the Panel class, which extends the Container class. The Container class extends Object, which is the parent of all Java API classes. The Applet class provides the init, start, stop, destroy, and paint methods you saw in the example applet. The SimpleApplet class overrides these methods to do what the SimpleApplet class needs them to do. The Applet class provides no functionality for these methods.However, the Applet class does provide functionality for the setBackground method,which is called in the init method. The call to setBackground is an example of calling a method inherited from a parent class in contrast to overriding a method inherited from a parent class.You might wonder why the Java language provides methods without implementations. It is to provide conventions for everyone to use for consistency across Java APIs. If everyone wrote their own method to start an applet, for example, but gave it a different name such as begin or go, the applet code would not be interoperable with other programs and browsers, or portable acrossmultiple platforms. For example, Netscape and Internet Explorer know how to look for the init and start methods.3.2 BehaviorAn applet is controlled by the software that runs it. Usually, the underlying software is a browser, but it can also be appletviewer as you saw in the example. The underlying software controls the applet by calling the methods the applet inherits from the Applet class.The init Method: The init method is called when the applet is first created and loaded by the underlying software. This method performs one-time operations the applet needs for its operation such as creating the user interface or setting the font. In the example, the init method initializes the text string and sets the background color.The start Method: The start method is called when the applet is visited such as when the end user goes to a web page with an applet on it. The example prints a string to the console to tell you the applet is starting. In a more complex applet, the start method would do things required at the start of the applet such as begin animation or play sounds.After the start method executes, the event thread calls the paint method to draw to the applet's Panel. A thread is a single sequential flow of control within the applet, and every applet can run in multiple threads. Applet drawing methods are always called from a dedicated drawing and event-handling thread.The stop and destroy Methods: The stop method stops the applet when the applet is no longer on the screen such as when the end user goes to another web page. The example prints a string to the console to tell you the applet is stopping. In a more complex applet, this method should do things like stop animation or sounds.The destroy method is called when the browser exits. Your applet should implement this method to do final cleanup such as stop live threads.3.3 AppearanceThe Panel provided in the Applet class inherits a paint method from its parent Container class. To draw something onto the Applet's Panel, you implement the paint method to do the drawing. The Graphics object passed to the paint method defines a graphics context for drawing on the Panel. The Graphics object has methods for graphical operations such as setting drawing colors, and drawing graphics, images, and text.The paint method for the SimpleApplet draws the I'm a simple applet string in red inside a blue rectangle.public void paint Graphics gSytln "Paint" ;//Set drawing color to blueg.setColor Color.blue ;//Specify the x, y, width and height for a rectangleg.drawRect 0, 0,getSize .width -1,getSize .height -1 ;//Set drawing color to redg.setColor Color.red ;//Draw the text string at the 15, 25 x-y locationg.drawString text, 15, 25 ;4、PackagesThe applet code also has three import statements at the top. Applications of any size and all applets use import statements to access ready-made Java API classes in packages. This is true whether the Java API classes come in the Java platform download, from a third-party, or are classes you write yourself and store in a directory separate from the program. At compile time, a program uses import statements to locate and reference compiled Java API classes stored in packages elsewhere on the local or networked system. A compiled class in one package can have the same name as a compiled class in another package. The package name differentiates the two classes.The examples in Lessons 1 and 2 did not need a package declaration to call the Sytln Java API class because the System class is in the ng package that is included by default. You never need an import ng.* statement to use the compiled classes in that package.5、More InformationYou can find more information on applets in the Writing Applets trail in The Java Tutorial.文献译文Java 编程语言基础像Java Application小应用程序一样,Java Applet小程序也是从类中创建来的。
计算机专业毕业设计论文外文文献中英文翻译——java对象
1 . Introduction To Objects1.1The progress of abstractionAll programming languages provide abstractions. It can be argued that the complexity of the problems you’re able to solve is directly related to the kind and quality of abstraction。
By “kind” I mean,“What is it that you are abstracting?” Assembly language is a small abstraction of the underlying machine. Many so—called “imperative” languages that followed (such as FORTRAN,BASIC, and C) were abstractions of assembly language。
These languages are big improvements over assembly language,but their primary abstraction still requires you to think in terms of the structure of the computer rather than the structure of the problem you are trying to solve。
The programmer must establish the association between the machine model (in the “solution space,” which is the place where you’re modeling that problem, such as a computer) and the model of the problem that is actually being solved (in the “problem space,” which is the place where the problem exists). The effort required to perform this mapping, and the fact that it is extrinsic to the programming language,produces programs that are difficult to write and expensive to maintain,and as a side effect created the entire “programming methods” industry.The alter native to modeling the machine is to model the problem you’re trying to solve。
Java外文翻译
附件1:外文资料翻译译文图形用户接口一个基本的设计方针是“简单的事情变得容易,困难的事情成为可能。
”劳在Java的图形用户界面(GUI)库原设计目标是允许程序员建立一个GUI ,在所有平台上看起来好。
这一目标没有实现。
相反,Java的罗湖抽象窗口工具包(AWT )产生一个GUI,看着所有系统上同样表现平平。
此外,它是限制性的,你可以用四种字体,你不能访问任何更复杂的GUI 元素,在你的操作系统存在。
也尴尬和非面向对象的Java 1.0 AWT编程模型。
一个学生在我的一个研讨会(曾在Sun公司一直在创造Java的)解释原因:原来的AWT已经构思,设计,并在一个月内实施。
一定的生产力的奇迹,也是为什么设计对象的教训是非常重要的。
Java 1.1 AWT的事件模型,这需要一个更清晰的,面向对象的方法的JavaBeans组件的编程模型是面向可视化编程环境容易创造此外,情况有所好转。
的Java 2(JDK 1.2 ),基本上取代Java基础类(JFC),被称为GUI部分的所有“摇摆完成了转型。
”从旧的Java 1.0 AWT的这是一个易于使用的一整套丰富,易于理解的JavaBeans ,可以拖动和下降(以及手工编程),以建立一个合理的GUI 。
“第三次修订版”的软件产业规则(一个产品是不是良好,直到第三次修订版),似乎与编程语言也是如此。
本章介绍了现代的Java Swing库,使得Swing是Sun公司的最终目的地的GUI库,为Java.2合理的假设,如果你有一些原因,因为你支持旧的代码,你需要使用原有的“老”的AWT (或浏览器的限制),你可以找到介绍,在这本书的第一版在下载。
请注意,一些AWT 组件保持在Java中,并在某些情况下,你必须使用他们。
请注意,这是不是所有的Swing组件或描述类的所有方法的综合词汇。
你在这里看到的是一个简单的介绍。
Swing库是巨大的,本章的目的是只让你的要领和舒适的概念开始。
Java语言概述与面向对象思想中英文翻译
Java语言概述与面向对象思想Java,是由Sun Microsystems公司于1995年5月推出的Java程序设计语言和Java的总称。
用Java实现的Hot Java 浏览器(支持Java applet)显示了Java的魅力:跨平台、动态的Web、Internet计算。
从此,Java被广泛接受并推动了Web的迅速发展,常用的浏览器现在均支持Java applet。
平台Java平台由Java虚拟机(Java Virtual Machine)和Java 应用编程接口(Application Programming Interface、简称API)构成。
Java 应用编程接口为Java应用提供了一个独立于操作系统的标准接口,可分为基本部分和扩展部分。
在硬件或操作系统平台上安装一个Java平台之后,Java应用程序就可运行。
现在Java平台已经嵌入了几乎所有的操作系统。
这样Java程序可以只编译一次,就可以在各种系统中运行。
Java应用编程接口已经从1.1x版发展到1.2版。
目前常用的Java平台基于Java1.5,最近版本为Java1.7。
Java分为三个体系JavaSE(Java2 Platform Standard Edition,java 平台标准版),JavaEE(Java 2 Platform,Enterprise Edition,java平台企业版),JavaME(Java 2 Platform Micro Edition,java平台微型版)。
Java SEJAVA* Java SE(Java Platform,Standard Edition)。
Java SE 以前称为J2SE。
它允许开发和部署在桌面、服务器、嵌入式环境和实时环境中使用的Java 应用程序。
Java SE 包含了支持Java Web 服务开发的类,并为Java Platform,Enterprise Edition(Java EE)提供基础。
(完整word版)JAVA外文文献+翻译
Java and the InternetIf Java is, in fact, yet another computer programming language, you may question why it is so important and why it is being promoted as a revolutionary step in computer programming. The answer isn't immediately obvious if you’re comin g from a traditional programming perspective. Although Java is very useful for solving traditional stand—alone programming problems, it is also important because it will solve programming problems on the World Wide Web。
1.Client—side programmingThe Web’s in itial server—browser design provided for interactive content, but the interactivity was completely provided by the server. The server produced static pages for the client browser, which would simply interpret and display them。
Basic HTML contains simple mechanisms for data gathering: text-entry boxes, check boxes, radio boxes, lists and drop—down lists, as well as a button that can only be programmed to reset the data on the form or “submit” the data on the form back to the server。
Java编程语言基础(外文文献翻译)(可编辑)
JavaTM Programming Language BasicsLike applications, applets are created from classes. However, applets do not have a main method as an entry point, but instead, have several methods to control specific aspects of applet execution.This lesson converts an application from Lesson 2 to an applet and describes the structure and elements of an applet.1、Application to Applet2、Run the Applet3、Applet Structure and Elements4、Packages5、More Information1、Application to AppletThe following code is the applet equivalent to the LessonTwoB application from Lesson 2. The figure below shows how the running applet looks. The structure and elements of the applet code are discussed after the section on how to run the applet just below.import et;import hics;import r;public class SimpleApplet extends AppletString text "I'm a simple applet";public void inittext "I'm a simple applet";setBackground Color.cyan ;public void startSytln "starting..." ;public void stopSytln "stopping..." ;public void destroySytln "preparing to unload..." ;public void paint Graphics gSytln "Paint" ;g.setColor Color.blue ;g.drawRect 0, 0,getSize .width -1,getSize .height -1 ;g.setColor Color.red ;g.drawString text, 15, 25 ;The SimpleApplet class is declared public so the program that runs the applet a browser or appletviewer , which is not local to the program can access it.2、Run the AppletTo see the applet in action, you need an 6>HTML file with the Applet tag as follows:APPLET CODE SimpleApplet.class WIDTH 200 HEIGHT 100The easiest way to run the applet is with appletviewer shown below where simpleApplet.html is a file that contains the above HTML code:appletviewer simpleApplet.htmlNote: To run an applet written with JavaTM 2 APIs in a browser, the browser must be enabled for the Java 2 Platform. If your browser is not enabled for the Java 2 Platform, you have to use appletviewer to run the applet or install Java Plug-in. Java Plug-in lets you run applets on web pages under the 1.2 version of the Java VM instead of the web browser's default Java VM.3、Applet Structure and ElementsThe Java API Applet class provides what you need to design the appearance and manage the behavior of an applet. This class provides a graphical user interface GUI component called a Panel and a number of methods. To create an applet, you extend or subclass the Applet class and implement the appearance and behavior you want.The applet's appearance is created by drawing onto the Panel or by attaching other GUI components such as push buttons, scrollbars, or text areas to the Panel. The applet's behavior is defined by implementing the methods.3.1 Extending a ClassMost classes of any complexity extend other classes. To extend another class means to write a new class that can use the fields and methods defined in the class being extended. The class being extended is the parent class, and the class doing the extending is the child class. Another way to say this is the child class inherits the fields and methods of its parent or chain of parents. Child classes either call or override inherited methods. This is called single inheritance.The SimpleApplet class extends Applet class, which extends the Panel class, which extends the Container class. The Container class extends Object, which is the parent of all Java API classes. The Applet class provides the init, start, stop, destroy, and paint methods you saw in the example applet. The SimpleApplet class overrides these methods to do what the SimpleApplet class needs them to do. The Applet class provides no functionality for these methods.However, the Applet class does provide functionality for the setBackground method,which is called in the init method. The call to setBackground is an example of calling a method inherited from a parent class in contrast to overriding a method inherited from a parent class.You might wonder why the Java language provides methods without implementations. It is to provide conventions for everyone to use for consistency across Java APIs. If everyone wrote their own method to start an applet, for example, but gave it a different name such as begin or go, the applet code would not be interoperable with other programs and browsers, or portable acrossmultiple platforms. For example, Netscape and Internet Explorer know how to look for the init and start methods.3.2 BehaviorAn applet is controlled by the software that runs it. Usually, the underlying software is a browser, but it can also be appletviewer as you saw in the example. The underlying software controls the applet by calling the methods the applet inherits from the Applet class.The init Method: The init method is called when the applet is first created and loaded by the underlying software. This method performs one-time operations the applet needs for its operation such as creating the user interface or setting the font. In the example, the init method initializes the text string and sets the background color.The start Method: The start method is called when the applet is visited such as when the end user goes to a web page with an applet on it. The example prints a string to the console to tell you the applet is starting. In a more complex applet, the start method would do things required at the start of the applet such as begin animation or play sounds.After the start method executes, the event thread calls the paint method to draw to the applet's Panel. A thread is a single sequential flow of control within the applet, and every applet can run in multiple threads. Applet drawing methods are always called from a dedicated drawing and event-handling thread.The stop and destroy Methods: The stop method stops the applet when the applet is no longer on the screen such as when the end user goes to another web page. The example prints a string to the console to tell you the applet is stopping. In a more complex applet, this method should do things like stop animation or sounds.The destroy method is called when the browser exits. Your applet should implement this method to do final cleanup such as stop live threads.3.3 AppearanceThe Panel provided in the Applet class inherits a paint method from its parent Container class. To draw something onto the Applet's Panel, you implement the paint method to do the drawing. The Graphics object passed to the paint method defines a graphics context for drawing on the Panel. The Graphics object has methods for graphical operations such as setting drawing colors, and drawing graphics, images, and text.The paint method for the SimpleApplet draws the I'm a simple applet string in red inside a blue rectangle.public void paint Graphics gSytln "Paint" ;//Set drawing color to blueg.setColor Color.blue ;//Specify the x, y, width and height for a rectangleg.drawRect 0, 0,getSize .width -1,getSize .height -1 ;//Set drawing color to redg.setColor Color.red ;//Draw the text string at the 15, 25 x-y locationg.drawString text, 15, 25 ;4、PackagesThe applet code also has three import statements at the top. Applications of any size and all applets use import statements to access ready-made Java API classes in packages. This is true whether the Java API classes come in the Java platform download, from a third-party, or are classes you write yourself and store in a directory separate from the program. At compile time, a program uses import statements to locate and reference compiled Java API classes stored in packages elsewhere on the local or networked system. A compiled class in one package can have the same name as a compiled class in another package. The package name differentiates the two classes.The examples in Lessons 1 and 2 did not need a package declaration to call the Sytln Java API class because the System class is in the ng package that is included by default. You never need an import ng.* statement to use the compiled classes in that package.5、More InformationYou can find more information on applets in the Writing Applets trail in The Java Tutorial.文献译文Java 编程语言基础像Java Application小应用程序一样,Java Applet小程序也是从类中创建来的。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
毕业设计(论文)外文资料翻译系:计算机系专业:计算机科学与技术姓名:学号:外文出处:Ghosh,D..Java Object-oriented(用外文写)programming[J]. IEEE Transactionson SoftwareEngineering,2009, 13(3):42-45.附件: 1.外文资料翻译译文;2.外文原文。
注:请将该封面与附件装订成册。
附件1:外文资料翻译译文Java的面向对象编程——面向对象编程和它的关键技术—继承和多态性软件的重用可以节省程序开发时间。
它鼓励重复使用已经调试好的高质量的软件,从而减少系统运行后可能出现的问题。
这些都是令人振奋的可能性。
多态性允许我们用统一的风格编写程序,来处理多种已存在的类和特定的相关类。
利用多态性我们可以方便地向系统中添加新的功能。
继承和多态对于解决软件的复杂性是一种有效可行的技术。
当创建一个新的类时,而不用完整的写出新的实例变量和实例方法,程序员会指定新的类继承已定义的超类的实例变量和实例方法。
这个新的类被称为一个子类。
每个子类本身将来亦可有新的子类,而其本身将成为父类。
一个类的直接父类就是该类所直接继承的类(通过关键字extends继承)。
一个间接超类是通过从两级或更多级以上的类继承而来的。
例如,从类JApplet(包javax.swing 中)扩展来的类Applet(包java.applet)。
一个类单一的从一个父类继承而来。
Java 不支持多重继承(而C++可以),但它支持接口的概念。
接口可以使Java实现许多通过多重继承才能实现的优点而没有关联的问题。
我们将在本章讨论的接口的详细内容。
我们会给出创建和使用接口的一般规律和具体实例。
一个子类通常添加自己的实例变量和自己的实例方法,因此子类通常比父类大。
一个子类比它的父类更具体并且代表一组更小、更专业的对象。
通过单一继承,子类在开始时拥有父类的所有特性。
继承性真正的力量在于它可以在定义子类时增加或取代从超类中继承来的特征。
每个子类对象也是该类的父类的对象。
例如,每一个我们所定义的小程序被认为是类JApplet 的对象。
此外,因为Japplet继承了Applet,每一个我们所定义的小程序同时也被认为是一个Applet 的对象。
当开发applets时,这些信息是至关重要的,因为一个小程序容器只有当它是一个Applet才可以执行一个程序。
虽然子类对象始终可以作为它的父类的一种来看待,父类对象却不被认为是其子类类型的对象。
我们将利用这种“子类对象是父类对象”的关系来执行一些强大的操作。
例如,绘图程序可以显示一系列图形,如果所有的图形类型都直接或间接地继承同一超类,绘图程序就可以将所有图形存储在一个超类对象数组或其他数据结构中。
正如我们将要在这一章中看到的,这种处理单一类型的一系列的对象的能力是推动面向对象程序发展的重要推动力。
我们添加一个新的成员访问的一种控制形式——protected访问。
由同一个包中子类和其他类的方法组成的父类可以访问受保护的父类的成员。
开发软件的实践经验表明,处理的代码的重要部分涉及密切相关的案例。
因为设计人员和程序员十分专注于特殊案例,所以很难在这种系统中看到“大局”。
面向对象编程提供“透过树木见森林”的几种方法。
程序员和设计人员专注于系统中对象的共性而不是特定实例,这种方法叫做抽象。
如果一个程序性方案有许多密切相关的案例,那么就会常用到switch交换结构或嵌套的if / else结构从而区分众多的案例并提供独立处理各个案例的逻辑。
我们下面将学习如何使用继承性和多态性以更简单的逻辑来代替switch结构。
我们区分“is a”关系和“has a”的关系。
“is a”就是继承。
在“是”关系中,子类类型的对象也可以被看作是它的父类型的对象处理。
“有”是一种构成。
在“有”关系中,一个类对象有一个或多个其它类的对象作为成员。
例如,车有方向盘。
子类的方法可能需要确切访问它的父类的实例变量和方法。
在Java中,软件工程的一个至关重要的方面就是子类不能访问其父类的私有成员。
如果子类可以访问父类的私有成员,这就违背了父类的信息隐蔽原则。
然而,一个子类可以访问它的父类的public成员和protected成员。
如果子类和父类在同一个包中,子类也可以使用它的程序包访问父类成员。
如果超类不允许通过继承产生的子类访问它的某些成员,则需要用private声明成员。
子类只可以通过公有继承、受保护继承和程序包借助父类提供的继承到子类中的方法声明对父类中私有成员的改变。
继承会带来的问题是,子类会将一些没必要继承或不该继承方法也继承过来。
类的编写者应确保由类提供的功能对未来的子类是适用的。
即使父类的方法对子类适用,子类也可以使该方法来完成特定于子类的方式的任务。
在这种情况下,子类可以覆盖超类的方法,以提供一种合适的实现。
也许最令人兴奋的是一个新类可以从丰富的类库中继承,比如Java API提供许多类。
一些组织开发自己的类库的同时还具有可以利用现有的全球其他库的优势。
总有一天,大多数的软件可以通过可重用的标准化的组件来构建,就像现在制造硬件一样。
这将有助于面对开发我们将来可能需要的更加强大的软件的挑战。
我们常常会遇到这样一个问题,一个类的对象同时还“是”另一个类的对象。
矩形肯定是一个四边形(如同正方形,平行四边形和梯形)。
因此,Rectangle 类可以说是从Quadrilateral类继承而来的。
在这种情况下,Quadrilateral类是父类,Rectangle类是一个子类。
矩形是特殊的四边形,但却不能说四边形就是矩形(四边形可能是平行四边形)。
继承通常能够产生比其父类具有更多功能的子类,所以父类和子类的概念很容易引起混淆。
然而,我们还有另种一更好的方法来区分这两个概念。
因为每个子类对象也“是”其父类的对象,而一个父类又可以有很多子类,那么由父类所代表的一组对象通常比由该对象的父类的任何子类所代表的要大得多。
例如,Vehicle超类包含了所有的交通工具,如汽车,卡车,船,自行车等。
而Car子类仅表示交通工具Vehicle中的一个小子集。
继承关系可以用树型层次结构来表示。
一个父类与它的子类的构成层次关系。
一个类肯定可以独自存在,但当一个类是运用了继承的机理时,这个类要么成为一个提供属性和行为的父类,要么成为一个继承这些属性和行为的子类。
通常情况下,一个类既是父类也是子类。
一个子类的对象可以被当作其父类的对象来处理。
这使得可能会有一些有趣的操作。
例如,尽管有从一个特定的父类派生出的众多子类的对象彼此之间可能会有很大的不同的事实,但只要我们将他们当作父类的对象来看,我们仍可以创建一个引用的数组给他们。
但反之则不然:一个父类对象不能被当成一个子类对象。
例如,图形(Shape)不一定是圆(Circle)。
尽管子类的对象也“是”父类的对象,子类类型和父类类型却是不相同的。
子类对象可以被视为父类的对象。
这是合理的,因为子类含有和每个超类成员相对应的成员。
但也应认识到,子类通常拥有比父类更多的成员。
但Java不允许逆向赋值,因为如果把超类对象赋给子类的引用,就会使子类中额外的子类成员没有定义。
子类对象的引用可以被隐式地转换为超类对象的引用,因为根据继承性,子类对象“是”超类对象。
有四种可能的方法来使父类的对象和子类的对象与父类的引用和子类的引用相匹配:1、父类对象与可以直接用父类的引用。
2、子类对象与可以直接用子类的引用。
3、子类的对象用父类的引用是安全的,因为子类对象同样也是其父类的对象。
但这样的代码只能引用父类的成员。
如果该代码通过父类的引用来访问子类所特有的成员,编译器就会报告一个语法错误。
4、如果用子类来引用父类的对象,将报告一个语法错误。
尽管将子类的对象看成是父类的对象会带来很大的便利,而且可以通过这些父类的引用操纵这些对象来实现,但这会引发一个问题。
在一个工资管理系统,例如,我们希望能够通过一组员工数组来计算每个人的周薪。
但是直觉告诉人们,使用父类的引用将使程序只调用父类的工资计算程序(如果父类中确实有这样一个程序的话)。
我们需要一种方式仅通过使用父类的引用来正确的调用对每个对象(无论是父类对象或子类对象)相对应的工资计算程序。
其实,这正是当我们考虑了多态性和动态链接后Java所呈现的并将在此章节中讨论的内容。
我们可以使用继承来定制现有的软件。
当我们使用继承来从现有类创建一个新类时,新类将继承的原有类的属性和行为,此时我们可以添加属性和行为或重载父类的行为来定制能满足我们需要的类。
很难让学生意识到设计师和工业的大型软件项目的实施者所面临的问题。
做过这类项目的人都会说提高软件开发效率的最好方法是鼓励对软件的再利用。
一般来说,面向对象的编程,像Java,就可以实现。
实质和有用的类库使得通过及继承而实现的软件重用实现利益最大化。
人们对Java类库的兴趣随着Java的发展而增加。
正如独立软件厂商生产的压缩套装的软件伴随着个人电脑的问世而出现爆炸性的增长一样,Java类库的制造和销售也将呈现这样一个趋势。
应用程序设计人员将使用这些类库来构建他们的应用程序,而类库的设计者会因为将其开发的类库与应用程序打包在一起而得到收益。
在不久的将来,随着在大量领域的应用,Java的类库将会起到至关重要的作用并得到极大的发展。
附件2:外文原文(复印件)Java Object-oriented programming--Object-oriented programming and its key component technologies as inheritance and polymorphism.Software reusability saves time in program development. It encourages reuse of proven and debugged high-quality software, thus reducing problems after a system becomes operational. These are exciting possibilities. Polymorphism enables us to write programs in a general fashion to handle a wide variety of existing and yet-to-be-specified related classes.Polymorphism makes it easy to add new capabilities to a system. Inheritance and polym-orphism are effective techniques for dealing with software complexity. When creating a new class, instead of writing completely new instance variables and instance methods, the programmer can designate that the new class is to inherit the instance variables and instance methods of a previously defined superclass. The new class is referred to as a subclass. Each subclass itself becomes a candidate to be a superclass for some future subclass. The direct superclass of a class is the superclass from which the class explicitly inherits (via the keyword extends). An indirect superclass is inherited from two or more levels up the class hierarchy. For example, class JApplet (package javax.swing) extends class Applet (package java.applet). With single inheritance, a class is derived from one superclass. Java does not support multiple inheritance (as C++ does) but it does support the notion of interfaces. interfaces help Java achieve many of the advantages of multiple inheritance without the associated problems. We will discuss the details of interfaces in this chapter. We consider both general principles and a detailed specific example of creating and using interfaces. A subclass normally adds instance variables and instance methods of its own, so a subclass is generally larger than its superclass. A subclass is more specific than its superclass and represents a smaller, more specialized group of objects. With single inheritance, the subclass starts out essentially the same as the superclass. The real strength of inheritancecomes from the ability to define in the subclass additions to, or replacements for, the features inherited from the superclass. Every subclass object is also an object of that class’s superclass. For example, every applet we have defined is considered to be an object of class JApplet. Also, because JApplet extends Applet, every applet we have defined is considered to be an Applet. This information is critical when developing applets, because an applet container can execute a program only if it is an Applet. Although a subclass object always can be treated as one of its superclass types, superclass objects are not considered to be objects of their subclass types. We will take advantage of this “subclass-object-is-a-superclass-object” relationship to perform some powerful manipulations. For example, a drawing application can maintain a list of shapes to display. If all the shape types extend the same superclass directly or indirectly, the drawing program can store all the shapes in an array (or other data structure) of superclass objects. As we will see in this chapter, this ability to process a set of objects as a single type is a key thrust of object-oriented programming. We add a new form of member access control in this chapter, namely protected access. Subclass methods and methods of other classes in the same package as the superclass can access protected superclass members.Experience in building software systems indicates that significant portions of the code deal with closely related special cases. It becomes difficult in such systems to see the “big picture”beca use the designer and the programmer become preoccupied with the special cases. Object-oriented programming provides several ways of “seeing the forest through the trees.”The programmer and designer concentrate on the big picture—the commonality among objects in the system—rather than the special cases. This process is called abstraction.If a procedural program has many closely related special cases, then it is common to see switch structures or nested if/else structures that distinguish among the special cases and provide the processing logic to deal with each case individually. We will show how to use inheritance and polymorphism to replace such switch logic with much simpler logic. We distinguish between the “is a” relationship and the “has a” relationship. “Is a”is inheritance. In an “is a” relationship, an object of a subclass type may also be treated as an object of its superclass type. “Has a” is composition. In a“has a” relationship, a class object has one or more objects of other classes as members. For example, a car has a steering wheel. A subclass’s methods might need to access certain of its superclass’s instance variables and methods. A crucial aspect of software engineering in Java is that a subclass cannot access the private members of its superclass. If a subclass could access the superclass’s private members, this would violate information hiding in the superclass.However, a subclass can access the public and protected members of its superclass.A subclass also can use the package access members of its superclass if the subclass and superclass are in the same package. Superclass members that should not be accessible to a subclass via inheritance are declared private in the superclass. A subclass can effect state changes in superclass private members only through public, protected and package access methods provided in the superclass and inherited into the subclass.A problem with inheritance is that a subclass can inherit methods that it does not need or should not have. It is the class designer’s responsibility to ensure that the capabilities provided by a class are appropriate for future subclasses. Even when the superclass methods are appropriate for the subclasses, it is common for a subclass to require the method to perform a task in a manner that is specific to the subclass. In such cases, the superclass method can be overridden (redefined) in the subclass with an appropriate implementation.Perhaps most exciting is the notion that new classes can inherit from abundant class libraries, such as those provided with the Java API.Organizations develop their own class libraries and can take advantage of other libraries available worldwide. Someday, most software might be constructed from standardized reusable components, just as hardware is often constructed today. This will help meet the challenges of developing the ever more powerful software we will need in the future.Often an object of one class “is an” object of another class as well. A rectangle certainly is a quadrilateral (as are squares, parallelograms and trapezoids). Thus, class Rectangle can be said to inherit from class Quadrilateral. In this context, classQuadrilateral.is a superclass, and class Rectangle is a subclass. A rectangle is a specific type of quadrilateral, but it is incorrect to claim that a quadrilateral is a rectangle (the quadrilateral could be a parallelogram).Inheritance normally produces subclasses with more features than their superclasses, so the terms superclass and subclass can be confusing. There is another way, however, to view these terms that makes perfectly good sense. Because every subclass object “is an”object of its superclass, and because one superclass can have many subclasses, the set of objects represented by a superclass is normally larger than the set of objects represented by any of that superclass’s subclasses. For example, the superclass Vehicle represents in a generic manner all vehicles, such as cars, trucks, boats, bicycles and so on. However, subclass Car represents only a small subset of all the Vehicles in the world.Inheritance relationships form tree-like hierarchical structures. A superclass exists in a hierarchical relationship with its subclasses. A class can certainly exist by itself, but it is when a class is used with the mechanism of inheritance that the class becomes either a superclass that supplies attributes and behaviors to other classes or a subclass that inherits those attributes and behaviors. Frequently, one class is both a subclass and a superclass.An object of a subclass can be treated as an object of its superclass. This makes possible some interesting manipulations. For example, despite the fact that objects of a variety of classes derived from a particular superclass might be quite different from one another, we can create an array of references to them—as long as we treat them as superclass objects. But the reverse is not true: A superclass object cannot always be treated a subclass object. For example, a Shape is not always a Circle.Despite th e fact that a subclass object also “is a” superclass object, the subclass type and the superclass type are different. Subclass objects can be treated as superclass objects. This makes sense because the subclass has members corresponding to each of the superclass members—remember that the subclass normally has more members than the superclass has. Assignment in the other direction is not allowed because assigning a superclass object to a subclass reference would leave the additional subclass members undefined.A reference to a subclass object could be implicitly converted into a reference to a superclass object because a subclass object is a superclass object through inheritance.There are four possible ways to mix and match superclass references and subclass references with superclass objects and subclass objects:1. Referring to a superclass object with a superclass reference is straightforward.2. Referring to a subclass object with a subclass reference is straightforward.3. Referring to a subclass object with a superclass reference is safe, because the subclass object is an object of its superclass as well. Such code can refer only to superclass members. If this code refers to subclass-only members through the superclass reference, the compiler will report a syntax error.4. Referring to a superclass object with a subclass reference is a syntax error.As convenient as it might be to treat subclass objects as superclass objects, and to do this by manipulating all these objects with superclass references, there appears to be a problem. In a payroll system, for example, we would like to be able to walk through an array of employees and calculate the weekly pay for each person. But intuition suggests that using superclass references would enable the program to call only the superclass payroll calculation routine (if indeed there is such a routine in the superclass). We need a way to invoke the proper payroll calculation routine for each object, whether it is a superclass object or a subclass object, and to do this simply by using the superclass reference. Actually,this is precisely how Java behaves and is discussed in this chapter when we consider polymorphism and dynamic binding.We can use inheritance to customize existing software. When we use inheritance to create a new class from an existing class, the new class inherits the attributes and behaviors of an existing class; then we can add attributes and behaviors or override superclass behaviors to customize the class to meet our needs.It can be difficult for students to appreciate the problems faced by designers and implementers on large-scale software projects in industry. People experienced on such projects will invariably state that a key to improving the software development process is encouraging software reuse. Object-oriented programming in general, and Javain particular, certainly does this.It is the availability of substantial and useful class libraries that delivers the maximum benefits of software reuse through inheritance. As interest in Java grows, interest in Java class libraries will increase. Just as shrink-wrapped software produced by independent software vendors became an explosive growth industry with the arrival of the personal computer, so, too, will the creation and sale of Java class libraries. Application designers will build their applications with these libraries, and library designers will be rewarded by having their libraries wrapped with the applications. What we see coming is a massive worldwide commitment to the development of Java class libraries for a huge variety of applications arenas.。