It's not a secret anymore!*
The moose likes Beginning Java and the fly likes java is compiled or interpreted Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java is compiled or interpreted" Watch "java is compiled or interpreted" New topic
Author

java is compiled or interpreted

Amirtharaj Chinnaraj
Ranch Hand

Joined: Sep 28, 2006
Posts: 236
hi guys

please tell me wether java is compiled or interpreted language

buy the way please give me some evidence

regards
amir
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41096
    
  44
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.


Ping & DNS - my free Android networking tools app
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
As explained by Ulf , its both.
First compiled into bytecodes and then interperted by the virtual machine.


Rahul Bhattacharjee
LinkedIn - Blog
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18511
    
  40

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 ]

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Amirtharaj Chinnaraj
Ranch Hand

Joined: Sep 28, 2006
Posts: 236
i thank one and all

for your useful replies

regards
amir
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java is compiled or interpreted
 
Similar Threads
java compiled or interpreted ?
Java is an interpreted language...why?
arabic language programming
Is Java Plateform Independent ?
why java interprets?