Java is an pure object oriented programming language, it uses the concepts of Classes, Objects, Inheritance, Polymorphism. And the execution of a program is non-linear.
It is so called because you can’t write a program with out using classes & objects.

  • Java’s motto (so to speak) is “write once run anywhere”.
  • When you compile a Java program, an intermediate bytecode is generated, which itself is interpreted by the Java Virtual Machine. This way you write a program once, and the virtual machine translates the bytecode into instructions a specific processor can understand.
  • Execution of a Java program is by consequence a bit slow, because the intermediate bytecode has to be interpreted.
  • Java uses a “Garbage Collector” which manages memory automatically so the programmer doesn’t have to handle that.
  • Variables in Java can be declared anywhere in a program. (Although it is recommended to declare/define them at the beginning of blocks).
  • Reuse of code achieved by inheritance.
  • By default members are private.
  • During the execution of bytecode by JVM, it does not substitute the entire classes of package which are imported in the program. It just enters the package and executes the class and returns result in to the program. Due to this less memory is used by java program.

C Programming Language

  • C uses concept of structures (not object oriented).
  • In C we use the concept of pointers whereas there are no pointers used in JAVA
  • In C the programmer needs to manage memory manually. “malloc()” and “free()” are the fundamental memory allocation library calls.
  • In C the declaration of variables should be on the beginning of the block.
  • C supports go to statement, struct and union unlike Java
  • C is compiled to the machines “native language” so it’s execution is much faster than Java’s.
  • No reuse in code and by default members are public.
  • C programs will have a larger memory footprint than an equivalent program written in pure machine code, but the total memory use of a C program is much smaller than the a Java program because C does not require the loading of an execution interpreter like the JVM.
  • The main differences between Java and C are speed, portability, and object-orientation.

Java was created for the purpose of making a language that could be implemented on many different types of computers (cell phone, mac, PC, linux, etc.) C on the other hand can only be run on a computer of the same type as the one that compiled the program.

Java is also object-oriented, whereas C is not. Java allows a user to create classes that contain data and methods. C is not capable of doing that.