Home Java Beginners Difference between Java and C++
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Difference between Java and C++

Advertisement
Java is an Object Oriented Programming(OOPs) language, developed by James Gosling 1992. Important feature of java is that it allows the developer to Write Once Run Anywhere (WORA) meaning that the code that run on one platform need not required to compile again on another platform. C++ is a superset of C, because it has many new feature other than that already exist in C language.

Difference between Java and C++

  • Java is an Object Oriented Programming(OOPs) language, developed by James Gosling 1992. Important feature of java is that it allows the developer to Write Once Run Anywhere (WORA) meaning that the code that run on one platform need not required to compile again on another platform. Java application are compiled to byte code that can run on any Java Virtual Machine (JVM). Everything in java is treated as an object.
  • C++ is a superset of C, because it has many new feature other than that already exist in C language. C++ is a middle level programming language as it is a known as combination of both high level and low level language feature. It was developed by Bjarne Stroustrup at bell lab in 1979, as an enhancement to the C language. Originally named as "C with classes", but later it was renamed to C++ in 1983. C++ is a general purpose programming language that supports procedural programming and object oriented programming.
  • C++ fully support object oriented programming including four pillar: Data hiding, Encapsulation, Inheritance and polymorphism.
  • C++ was designed for system and application programming. C++ has added support for object-oriented programming, exception handling, generic programming and template.
  • Java was designed initially as an interpreter for printing system but later used for network computing.

Differences are as follows:

C++Java
C++ is known as superset of C language.Java is not supersets of any language, but syntax is taken from C and C++.
C++ supports procedural, functional and object oriented programming language.Java Supports only object oriented programming language.
C++ supports pointer concept.Java does not supports pointer concept, for memory management garbage collector is used.
C++ supports operator overloading.Java does not support operator overloading.
C++ supports multiple inheritance. Java support single inheritance, A class can implements multiple interfaces.
Inline documentation mechanism not supported. For documentation Javadoc is used.
Supports goto statement.Supports Label with loop and statement block.
Const keyword is used to defined variable and method that do not change the object..final keyword is used in place of const keyword.

Syntax:

C++Java
#include <iostream>
using namespace std;
// main() is where program execution begins.

int main()
{
cout << "Rose India"; // prints Rose India
return 0;
}
public class Demo {

public static void main(String []args) {
System.out.println("Rose India"); // prints Rose India
}
}
Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: May 8, 2013

Ask Questions?    Discuss: Difference between Java and C++  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com