Posted By:
8 Feb, 2014 6:14 am PST

Difference between Java and C

Difference between Java and C programming language



C Programming language

1. Java is Object-oriented and high-level language.Java breaks down to objects.


1.C is a Procedural and low-level Language It breaks down into function

2. Java is a Interpreted language.While the java code is transformed into bytecodes which is executed by JVM(Java Virtual Machine).span>

2.C language is Compiled language.Compiler takes user code and translate that code into the machine understandable format(in the form of 0’s and 1’s).

3. JAVA uses the bottom-up  approachwhere the smaller elements combine together to form the whole

3.  C uses the top-down approachwhich is sharp and smooth...

 4. We don’t deal with pointers in Java

 4.Here there is an explicit handling of pointers.

 5. Here in Java ,Memory Management is done by Garbage Collector.


 5.In c ,memory is managed by the user.

 6. Constants are declared using final keyword .Example: final SUM = 0;

 6.Constants are declared using const and #define.

Example: const int Constant = 0;

7. Java supports Method Overloading that is we have two or more functions with the same name with certain varying parameters.


7.C does not support Method Overloading.

8. Java does support Preprocessors

8. C supports Preprocessors.

9. When a error occurs in Java ,it results in an exception being thrown.

9.Here errors and crashes occurs.


10. Allocation of memory occur using new.



10. Allocation of memory occur using malloc();

11. Variable declaration can be at the beginning of the block or before you use it.

11. Variable declaration at the beginning of the block.



Pros of Java over C 

1.Java is easy to learn and read than C.

2.Java is platform autonomous ,it can anywhere but it is not such in case of C. 

3.Garbage collector cleaning up objects once they're no longer used, so you don't have to manually track everything yourself.But in C memory is managed by the user.

4. As Java is free from pointers and Preprocessor ,complexity of program decrease compared to C.

5.Various free IDEs available on all platforms, such as Eclipse.No such thing in C.

6.Easier and more cross-platform Networking in Java than C


Cons of Java over C

1.Java use more memory than C

2.Java does not let you decide whether a type should be a value or a reference type(determing if it is call by value or call by reference) unlike C

3.  Java is quite slow than C, because it is essentially compiled at run-time by the system's virtual machine.

4. It is difficult to compile into a stand-alone application.

5.Bugs in library implementations (especially Swing).

6.Here in Java there is no generic programming means no StronglyTypedCollections unless you write 'em yourself one at a time.

7. Immutable types are a damn poor substitute for restricted references



Is there a mistake at the 8th of The difference between Java and C?

Was it useful?  

Please login to reply to this problem.