Thursday, 21 May 2015

How Java is different from C and C++

Even though java was developed after C and C++ languages, it differs from C and C++ in many ways. Java does not incorporate all the features of  C and C++.




How Java is different from C 


                            Java is complete an object oriented programming language comes to fulfill all the needs of emerging technology But is a procedure oriented programming language developed to write user friendly programming application. As I had mentioned in the  History of Java. Java was originally designed to develop consume electronic application and to run applications on Internet. Later it becomes a programming language.


  • Java does not include the C unique statement keywords sizeof and typedef.
  • Java does not contain data types structures and unions.
  • Java does not define the type modifier keywords auto, extern, register, signed and unsigned 
  • Java does not support an explicit pointer type.
  • Java does not have a preprocessor  and therefore we cannot use #define, #include statements.
  • Java requires that the functions with no arguments must be declared with an empty parenthesis and not with the void keyword as done in C.
  • Java adds new operators such as instanceof and >>>.
  • Java adds labelled break and continue statements.
  • Java adds many features required for object oriented programming.


How Java is different from C++


                                             Java is true object oriented programming language, while C++ is basically C with object oriented extension. All the important features of C programming are also available in C++ also. One can write a C++ program without using classes and object. But it is not possible to write a java without using classes and objects.

  • Java does not support operator overloading 
  • Java does not have template classes as in C++
  • Java does not support multiple inheritance of classes. This can be accomplished using a new feature called " interfaces".
  • Java does not support global variables. Every variable and method is declared within a class and forms part of that class.
  • Java does not use pointers.
  • Java has replaced the destructors function with a finilize() function.
  • There are header files in java.
  • There are no friend , inline functions in java.
  • Java does not supports copy constructors.
  • There is scope resolution operator in java.
  • There is use of namespace in java.


          So, from the above two differences now it is clear how java is differ from both C and C++. Java also contain feature of both C and C++. But we cannot use them directly into our java programming. So, we can java is a purely object oriented programming language. 

0 comments:

Post a Comment

Advertisement

Find Us On Facebook

C Programming

More

C++ Tutorial

More

Java Tutorial

More

Computer Basics

More

MS Office

More

Database Management

More
Top