【正文】
are errorprone. . . . The single biggest difference between Java and C/C++ is that Java has a pointer model that elim inates the possibility of overwriting memory and corrupting data. Java is intended to be used in worked/distributed environments. Toward that end, a lot of emphasis has been placed on security. Java enables the construction of virusfree, tamperfree systems. From the beginning, Java was designed to make certain kinds of attacks impossible, among them: ? Overrunning the runtime stack—a mon attack of worms and viruses ? Corrupting memory outside its own process space ? Reading or writing files without permission Neutral The piler generates an architectureneutral object file format—the piled code is executable on many processors, given the presence of the Java runtime system. The Java piler does this by generating bytecode instructions which have nothing to do with a particular puter architecture. Rather, they are designed to be both easy to interpret on any machine and easily translated into native machine code on the fly. Unlike C and C++, there are no “implementationdependent” aspects of the specifi cation. 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 32bit integer. In C/C++, int can mean a 16bit integer, a 32bit integer, or any other size that the piler 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 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. Performance While 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 runtime) into machine code for the particular CPU the application is running on. [The] benefits of multithreading are better interactive responsiveness and realtime behavior. In 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 meth ods and instance variables without any effect on their clients. In Java, finding out runtime 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 Inter to run in a browser. In Java , finding out runtime type information was anything but straightforward, but current versions of Java give the programmer full insight into both the structure and behavior of its objects. This is extremely useful for systems that need to analyze objects at runtime, such as Java GUI builders, smart debuggers, pluggable ponents, and object databases. Common Misconceptions about Java is an extension of HTML. Java is a programming language。 XML is a way to describe data. You can process XML da