Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java is compiled or interpreted

 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

please tell me wether java is compiled or interpreted language

buy the way please give me some evidence

regards
amir
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's both. The javac compiler compiles .java files into .class files (which contain so-called bytecode, which is cross-platform compatible). The JVM then interprets the bytecode (and may compile some of it into native code).

If you're interested in the details, then the JVM specification has lots of interesting stuff.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As explained by Ulf , its both.
First compiled into bytecodes and then interperted by the virtual machine.
 
Henry Wong
author
Marshal
Pie
Posts: 20833
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most modern JVMs are based on Hotspot technology. This means that when a class is first used, it will be interpreted, until the natively compiled version is ready.

Furthermore, it will also track the program while it is running, and tune optimization as needed. It will even go back and adaptively recompile portions of the code as necessary to optimize the code (based on usage patterns).

This last part is where it gets it's name "hotspot". It will adaptively optimize the parts of the code that runs repeatedly.

Henry
[ February 03, 2007: Message edited by: Henry Wong ]
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i thank one and all

for your useful replies

regards
amir
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic