• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

compilation vs interpretation?

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the basic diffrence between compilation and interpretation?


does both things happen in java and C++?
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since this is a learning site, what do YOU think are the differences betweent the two terms?
 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
interpretor shows errors in each line is it?

interpretor is available in java only if we use IDE's is it?


compilation means changing the source code to .exe file in C/C++ and in java to bytecode(.class) so that jvm can run it is it right?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

interpretor shows errors in each line is it?


No, that's possible with compiled code as well.

interpretor is available in java only if we use IDE's is it?


No, the Java Runtime Environment (JRE) has both compiling and interpreting modes. Both are available either if the program is run inside of an IDE, or started from the command line.

compilation means changing the source code to .exe file in C/C++ and in java to bytecode(.class) so that jvm can run it is it right?


With Java the source first gets compiled into bytecode in class files. Then at runtime the bytecode is interpreted, and may optionally be compiled to native machine code. When I say "optionally", what that means is that almost always it will get compiled. Using only interpretation makes for much slower programs.
[ November 13, 2007: Message edited by: Ulf Dittmer ]
 
Greenhorn
Posts: 1
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java uses a combination of compilation and interpretation. When you create and save a Java source code file (the file that contains your Java instructions and is saved using the .java extension) it needs to be translated before a computer can understand the instructions. So we compile the .java file. However, unlike other compiled languages, the Java compiler does not produce machine code designed specifically for a particular type of computer. Instead, it produces a new file containing bytecode, and this file has the .class extension. Bytecode is like an idealised form of machine language, and the really special thing about bytecode is that it is not machine dependent. Another words, the bytecode produced by the Java compiler is not designed so that only one type of computer can read it, any computer (that has the Java interpreter installed) can read and understand bytecode. The Java interpreter is sometimes referred to as the "Java Virtual Machine" ( Java VM for short) and some books even refer to it as the "Java run-time system". The interpreter on your computer takes the Java bytecode in the .class file, turns it into machine code which your particular computer can understand, and then executes (or "runs") the code.

You might wonder why the Java creators designed things this way - why use a two stage approach instead of just compiling or just interpreting the code like most other languages do? Well, the advantage is that once a Java file has been compiled, any computer with a Java VM can interpret and run that file. So the code is a lot more portable. Think about the huge number of network and Internet applications we run today - lots of different types of computers trying to communicate with each other. This approach overcomes these machine-dependency problems.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
chaithra rao, Welcome to the ranch !

Please take some time to check this.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And credit your source.
 
reply
    Bookmark Topic Watch Topic
  • New Topic