Sunday, October 28, 2018

Difference between C and Java

Difference between .exe and .class

.exe file contains machine language instructions for the microprocessor. It is system dependent. .class file contains byte code instructions for JVM. It is system independent.

Difference between #include and import statements

#include makes the compiler to copy the header file code into the C program so the program size will increase thus it wastes memory and processor time. Import statement makes JVM to go a package, execute the code and then substitute the result in a java program. So no code is copied. Import is more efficient than include. JRE = JVM + Java Library

Other Major Differences inlude


1. C breaks down to functions while JAVA breaks down to Objects. C is more procedure-oriented while JAVA is data-oriented.

2. Java is an Interpreted language while C is a compiled language.

3. C is a low-level language(difficult interpretation for the user, closer significance to the machine-level code) while JAVA is a high-level lagunage(abstracted from the machine-level details, closer significance to the program itself).

4. C uses the top-down {sharp & smooth} approach while JAVA uses the bottom-up {on the rocks} approach.

5. Pointer go backstage in JAVA while C requires explicit handling of pointers.

6. The Behind-the-scenes Memory Management with JAVA & The User-Based Memory Management in C.

7. JAVA supports Method Overloading while C does not support overloading at all.

8. Unlike C, JAVA does not support Preprocessors, & does not really them.

9. The standard Input & Output Functions. Although this difference might not hold any conceptual(intuitive) significance, but it’s maybe just the tradition. C uses the printf & scanf functions as its standard input & output while JAVA uses the System.out.print & System.in.read functions.

10. Exception Handling in JAVA And the errors & crashes in C. When an error occurs in a Java program it results in an exception being thrown. It can then be handled using various exception handling techniques. While in C, if there’s an error, there IS an error.

No comments:

Post a Comment