Programming‎ > ‎Java‎ > ‎


Compiled Vs Interpreted

Java is a compiled programming language, but rather than compile straight to executable machine code, it compiles to an intermediate binary form called JVM byte code. The byte code is then compiled and/or interpreted to run the program.

  • Interpretors run source program, "interpreting" the source code on the fly.
  • Compilers translate the source program to machine language.
    • Well, actually, they usually translate it to object code.
    • The object code is "linked" with other code by a linker.
  • Speed
    • Compilers win
    • Optimizing compilers really win
    • (In Java automatic garbage collector runs as a low-priority background thread e.g. improves response.)
  • Security, viruses etc.
    • Fully interpreted languages win
  • Java is interpreted.
    • Well, actually, it's compiled to "bytecodes".
    • Bytecodes are interpreted by a virtual machine.
    • The virtual machine is emulated by the Web browser.
  • Java is a trade off between speed and security.

What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?


Advantages of Java

1. Runtime environment that provides platform independence. You can use the same code on Windows, Solaris, Linux etc

2. Java is fully object oriented. Everything in Java, except for a few basic types like numbers is an object.

3. Java designers eliminated manual memory allocation and deallocation. Use garbage collector.

4. Java introduced true arrays and eliminated pointer arithmetic. No worries on overwriting an area of memory.

5. Eliminated the possibility of confusing an assignment with a test for equality in a condition statement. Example if (count = 3)

6. Eliminated multiple inheritance, replacing it with a new notion of interface.