File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

java is compiled or interpreted

Amirtharaj Chinnaraj
Ranch Hand

Joined: Sep 28, 2006
Posts: 241
hi guys

please tell me wether java is compiled or interpreted language

buy the way please give me some evidence

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
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

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

Joined: Sep 28, 2004
Posts: 20521

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.

[ 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: 241
i thank one and all

for your useful replies

I agree. Here's the link:
subject: java is compiled or interpreted
It's not a secret anymore!