What is the difference between C++ & Java?

Answer Posted / sowmya

Feature C C++ Java
Paradigms Procedural Procedural, OOP, Generic Programming OOP, Generic Programming (from Java 5)
Form of Compiled Source Code Executable Native Code Executable Native Code Java bytecode
Memory management Manual Manual Managed, using a garbage collector
Pointers Yes, very commonly used. Yes, very commonly used, but some form of references available too. No pointers; references are used instead.
Preprocessor Yes Yes No
String Type Character arrays Character arrays,
Feature C C++ Java
Paradigms Procedural Procedural, OOP, Generic Programming OOP, Generic Programming (from Java 5)
Form of Compiled Source Code Executable Native Code Executable Native Code Java bytecode
Memory management Manual Manual Managed, using a garbage collector
Pointers Yes, very commonly used. Yes, very commonly used, but some form of references available too. No pointers; references are used instead.
Preprocessor Yes Yes No
String Type Character arrays Character arrays, objects Objects
Complex Data Types Structures, unions Structures, unions, classes Classes
Inheritance N/A Multiple class inheritance Single class inheritance, multiple interface implementation
Operator Overloading N/A Yes No
Automatic coercions Yes, with warnings if loss could occur Yes, with warnings if loss could occur Not at all if loss could occur; msut cast explicitly
Variadic Parameters Yes Yes No
Goto Statement Yes Yes No

Is This Answer Correct ?    18 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can constructor be inherited?

572


What is the size of boolean variable?

566


Can a class extends itself in java?

525


When is an object subject to garbage collection?

570


how we can make a write-only class in java?

553






What is the tradeoff between using an unordered array versus an ordered array?

652


What is a stringbuffer?

506


What are the types of sockets in java?

535


Similarity and difference between static block and static method ?

530


Is java platform independent?

561


Can I learn java in 3 months?

532


How to change the priority of thread or how to set the priority of thread?

609


What does it mean that a class or member is final?

550


What is internal iteration in java se 8?

621


FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?

2625