An important bond exists between C/C++ and Java. C is the parent language of both C++ and Java. James Gosling implemented the initial versions of Java using C++, but he also took the opportunity presented by Java’s unique language model to modify its structure and make it more programmer-friendly than C/C++.
One major innovation relates to memory management. In practical terms, Java prevents you from going into an operating system and telling it to reserve or in other ways use the memory of a specific machine. Java was designed to do this because memory management is one of the
One major activity of memory management involves setting aside (allocating) memory used by the program. An object-oriented program often performs this memory-management task by creating a program component known as an object (an instance of a class). In Java, for example, the JDialog or JFrame classes allow you to create dialogs and windows. When such objects are created, they can bog down the performance of a computer if they are not also destroyed when they are no longer in use. Java takes care of such activity through what is generally known as automated cleanup or garbage collecting. When an object falls into disuse, Java cleans it up for you. You do not have to count and manage objects, as you do with C++.
Java also differs from C++ along the following lines:
· There is no preprocessing of source files in Java.
· In Java there is no split between the interface or header (.h) and the implementation (.cpp) file; there is only one source file (.java).
· Everything in Java is an object in the form of a class. In C++, you can revert to C and start writing code that does not involve classes, even to the point of creating global variables. In Java, you cannot define global variables (values that exist outside a class).
· Java has no autocasting of types; you have to be explicit.
· Java has a simplified object model and patterns; there is no support for multiple inheritance, templates, or operator overloading.
For general application development, Java has far outdistanced C++ as the preferred language.
However, C++ still commands a strong position as a server-side programming language and in
the world of console game development. C++ programs execute much faster than Java programs, and C++ also provides programmers control over execution and memory. Such capabilities prove useful in some game-development contexts or contexts in which optimized performance is essential. Still, Java applications developed for general enterprise prevail. Java programs often perform better, have fewer bugs, and prove easier to develop and maintain. Moreover, there is no comprehensively unified enterprise or mobile development environment in C++. In this respect, the J2EE platform is the world’s standard for development of end-to-end enterprise information systems.
Thank you for visiting my site and hope some of this information can be useful for us all.
Source : Thomson Course Technology PTR, a division of Thomson Learning Inc. book of Java™ ME Game Programming second edition by John P. Flynt, Ph.D., and Martin J. Wells
0 komentar:
Posting Komentar