How java is different from c/c++?


How java is different from c?




1. C is structured oriented language(POP) while java is object oriented langauge and has mechanism to define classes and objects.

2. Java does not support an explicit pointer type.

3. Java does not have preprocessor, so we cannot use #define,#include and #ifdef statements.

3. java does not include struct enum and union datatype.

4. Java does not include keyword like goto, sizeof, typedef.

5. Java adds labelled break and continue statement.

6. Java adds many feature required for OOP




How Java is different from C++?


Features removed in java.

1. Java does not support pointers to void  i.e unauthorized access to memory.

2. Java does not include struct, enum,  union datatype.

3. Java does not support operator overloading.

4. Preprocessor plays less role in C++ and so eliminated entirely in Java.

5. Java does not perform automatic type conversion and result in loss of precision.

6. Java does not support global variables.Every method and variable is declared within a class and forms part of that class.

7. Java does not allow default arguments.

8. Java does not support inheritance of multiple super classes by a subclass(multiple inheritance). This is accompalished by using Interface concept which we will learn later.

9. It is not possible to declare unsigned integers in Java.

10. In Java objects are passed by refrence only. In C++ objects may be passed by value or refrence.


New features added in java ??




1. Multithreading  that allows two or more pieces of same program to execute concurrently(e.g. audio and video playing simultaneoulsy when we play and multimmedia)

2. C++ has a set of library function that use a common header file.But java replaces it with its own API classes.

3. It adds packages and interfaces.

4. Java supports automatic garbage collection.

5. Break and Continue statements has been enhanced in java to accept labels as targets.

6.The use of unicode character (accepted in worldwide) ensures portability.

7. Though C++ and Java supports boolean datatype , C takes any non zero value as true and zero as false. True false in Java are predefined literals that are values for a boolean expression.

8. Java has replaced the destructor function with finalize() function.

9. C++ supports exception handling that is similar to Java. However in C++ there is no requirement that a thrown exception be caught.

Comments

Popular posts from this blog

week 13( 4-8 November)

week 11(21-25 october)

week 14(11 -15 November)