Juxtaposition Java and C ++



If you work in C ++ for some time and have some basic knowledge of object-oriented programming (OOP), then work with Java will be smooth sailing for you. Java syntax is very similar to C ++, which makes sense, as Java was derived from C ++ like. However, surprisingly, there are several striking contrasts between the two languages. This article covers the visible characteristics that distinguish Java C ++:

1. Java integrates three types of comments, know / * text * /, // text and / ** documentation * /. Java enumerations extend java.lang.Enum

2. To provide type-safe containers, generic Java uses.

3. The Java garbage collection is automated. It facilitates memory allocation and deallocation of memory. In C ++ memory management depends CLR- destroyers, builders and smart pointers.

4. Java is checked limits while C ++ is not marked limits.

5. Built Java runs on the Java Virtual Machine (JVM), which is the portable byte compile Java code with all major processors and operating systems.
 
6. Build C ++ involves a phase called pre-processor. At this stage, the parameters are stored in the header files that are complementary to the original source files. Java compilation does not include pre-treatment phase. Java compiler in class definitions are built directly from source code files.

7. C ++, dynamic data structures are created and managed using pointers. In Java, the entire data structures maintenance process is simplified. Java uses references that do not allow unauthorized access to the memory of the application. This makes reliable and secure application.

8. C ++ encourages multiple inheritance while Java does not support multiple inheritance directly. For the functionality of multiple inheritance in Java, you have to trust the implementation of the interface.

In total, Java is more robust and scalable compared to C ++, the following reasons:

Any table accessed by Java are analyzed for violation of limits.
Handles objects are always initialized to null.
Java exception handling is relatively error-free and clean.
Memory loss is preventable through automated waste collection.
Multithreading is made with the support of a simple language.
The contrasts in Java and C ++ are certainly remarkable, but clearly goes beyond Java C ++ with its robust and scalable user friendly features.

Load disqus comments

0 komentar