+ 2

Java vs C++

Please explain main 5 difference between java and c++.

30th Mar 2017, 7:46 AM
Kuldeep Randhawa
Kuldeep Randhawa - avatar
4 Answers
+ 13
@Kris Clark C++ not C# C++ doesn't use garbage collection C++ is WAY faster C++ doesn't use virtual machines C++ doesn't try to make you install ask.com toolbar C++ is more low level
30th Mar 2017, 8:37 AM
Ahri Fox
Ahri Fox - avatar
+ 2
@Kuldeep I don't know any difference between them, but I want to ask this question:- why do you need only 5 differences... there may be more than that......
30th Mar 2017, 11:10 AM
Shiv Mishra🎸
Shiv Mishra🎸 - avatar
+ 1
1 extra difference to the ones listed above is Java is write once, run anywhere. Any Java program you make will run on any system with the JVM installed. C++ must be compiled for each architecture that you wish to run the program on.
30th Mar 2017, 9:08 AM
Hassie
Hassie - avatar
0
1. The mechanism of work with dynamic data and the garbage collectors In Java and C # are strong and weak references to the objects. Both languages support the finalizer method. Due to the uncertainty of the moment of the object removal, finalizers can not be used to release the system resources occupied by the object. This compels to create additional methods for the object “cleaning” and causes them explicitly. 2. Encapsulation In Java, the “protected” modifier in the description, besides the access from descendants classes, permits the access from all the classes that are in the same packet as the class owner. In C #, for the objects which should be visible in the range of assembly (the approximate analog of Java package) was introduced the separate “internal” modifier (“default” analog in Java), while “protected” retains its original meaning taken from C ++, the access only from descendants classes. You are able to combine “internal” and “protected”. 3. Inner classes Both languages allow determining the class inside the class. In Java, inner classes are used to emulate the circuits. C # has circuits and lambdas. 4. Methods In C # there is an obvious realization of the interface methods that allows any class implementing the interface methods separately from its own methods or to give different implementations of the same name methods belonging to the two different interfaces. In Java 8 the default operator has appeared which allows determining the implementation of the “default” interface methods. Thus, the interface class gets rid of the obligation to realize the default methods, but can override them. 5. Types of data Java and C# can refer to the several types. The other detailed information is described in this article - https://www.computoolsglobal.com/blog/java-vs-c/. Have a look!
30th Mar 2017, 8:16 AM
Kris Clark
Kris Clark - avatar