Thursday 14 September 2017

DIFFERENCE BETWEEN C,C++ AND JAVA



DIFFERENCES BETWEEN C,C++ AND JAVA IN A NUTSHELL

S.NO
C
C++
JAVA
1.
Structured programming language
Object-oriented programming language
Object-oriented programming language
2.
Compiled
Compiled
Compiled and interpreted
3.
32 keywords
Eg:- case, char
60 keywords
Eg:- class, protected
50 keywords
Eg:- interface, extends
4.
Rules for naming identifier
1.      Should begin with alphabet
2.      Can have numbers,underscore
3.      Keywords cannot used as identifiers
Rules for naming identifier
1.      Should begin with alphabet
2.      Can have numbers,underscore
3.      Keywords cannot used as identifiers
Rules for naming identifier
1.      Can  begin with alphabet, underscore or dollar symbol. But cannot begin with a  number
2.      Keywords cannot used as identifiers

5.
Comments:- /*….*/ (multi line comment),   //(single line comment)
Comments:- /*….*/ (multi line comment),   //(single line comment)
Comments:- /*….*/ (multi line comment),   //(single line comment), /** …. */(documentation comment)
6.
Data types :- int,char,float,double,void
Data types :- int,char,float,double,void
Data types:-
byte,short,int,long,
float,double,
char,boolean

7.
Bitwise shift operators are : >>(right shift),<<(left shift)
Bitwise shift operators are : >>(right shift),<<(left shift)
Bitwise shift operators are : >>(right shift),<<(left shift),>>>(triple right shift operator)
8.
Char is 8 bits wide
Char is 8 bits wide
Java uses Unicode to represent characters. It is 16 bits wide.
9.
Preprocessor directives allowed
Eg:- #include,#define
Preprocessor directives allowed
Eg:- #include,#define
No preprocessor directives
10.
Variables need not be initialized before using it
Variables need not be initialized before using it
Variables must be initialized before using it
11.
Array should be declared mentioning its size
Eg:- int num[10];
Array should be declared mentioning its size
Eg:- int num[10];
Arrays are declared without mentioning its size.
int num[];
 num=new int[10] (or)
int num[]=new int[10];
12.
Explicit string data type not available
Explicit string data type not available
String data type available in java. It is a class
13.
Supports pointers
Supports pointers
Does not support pointers
14.
Structures and unions available
Structures and unions available
Structures and unions not available
15.
-
Supports operator overloading
Does not support operator overloading
16.
-
Programs can be written in c++ without using a class
All the code in java program needs to be written in one or more classes
17.
Global variables and functions are allowed
Global variables and functions are allowed
No global variables or functions
18.
-
Allows default arguments in functions
Not allowed in java
19.
-
Supports multiple inheritance
Multiple inheritance not supported
20.
-
Supports constructors and destructors
Supports constructors, no destructors
21.
Supports typedef
Supports typedef
Does not support typedef
22.
Unsigned integers can be declared
Unsigned integers can be declared
No unsigned integers
23.
Allows goto
Allows goto
Does not allow goto
24.
-
delete operator available
No delete operator
25.
-
Objects may be passed by value or by reference
Objects are passed by reference only in Java




7 comments:

  1. Thanks for sharing this blog . Its very helpful for all all ugc net students
    UGC NET Computer Science Coaching in Chandigarh

    ReplyDelete
  2. The University Grants Commission of India (UGC India) is the primary regulatory body created by the Indian Government in accordance with the UGC Act of 1956 under the Ministry of Human Resource Development. It has been made responsible for the coordination of Indian Universities, determination of the standards for Indian universities and maintenance of standards of higher education in India.

    UGC Approved Journals list 2019

    Journals are the medium through which budding candidates publish their articles about their research. These sources are made available because of the UGC.

    If the aspirants choose any private journal except for UGC Approved Journals list for their research other than that, it is not considered as valid. As of now, the UGC Approved Journals list has now been replaced by UGC – CARE.

    ReplyDelete
  3. Thanks for sharing such great clarification. We've created some amazing
    mock tests for UGC NET Preparation for Aspirants.

    ReplyDelete
  4. Hey admin, I found some really interesting things. Thank you so much for sharing this. I am sharing some best software blogs to follow.

    The Software Tutorial
    My Software Tutorial
    Software Column
    Tech Community Online
    Tech Empire Online
    Blog Soft Web

    ReplyDelete
  5. Gyan Sagar Institute is considered as the Best UGC-NET Coaching Center in Chandigarh Sector-34/A. We not only focus on theory but also on practical knowledge. The main focus is on quality.

    ReplyDelete