Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Difference between Interpreter and Compiler

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Difference between Interpreter and Compiler

    Hello guys,

    Thanks for your help before.

    I am new in programming language, especially in Java. I am reading a java book and find a theory about Interpreter and Compiler. Could anyone explain different between them.

    Thanks,


  2. #2
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: Difference between Interpreter and Compiler

    Welcome to the forums!

    A big part of learning how to program is research and self learning. The good news that the largest library ever created is a google search away. Why don't you do a bit of reading and come back with your own understanding of the difference between the two and then we will have a discussion about things you don't fully understand.
    Computers are fascinating machines, but they're mostly a reflection of the people using them.
    -- Jeff Atwood

  3. #3
    Junior Member
    Join Date
    Aug 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Difference between Interpreter and Compiler

    Hello ChristopherLowe,

    Thanks for your advice. I have red several articles about them. The main point is the interpreter execute and translate the high level language into machine language line by line and show up if there is an error, but compiler execute all of codes and running it, and also show up if there is an error.

    one question from me,

    When we use interpreter and compiler ? because both same translate codes to machine language.

    Thanks,

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Difference between Interpreter and Compiler

    When we use interpreter and compiler ?
    Some languages are interpreted, some are compiled. You don't make the choice except by choosing which language to use.
    because both same translate codes to machine language.
    Sometimes there's an intermediate step. Java compiles to byte code which is interpreted by a JVM specific to the using computer's OS and processor.

  5. #5
    Junior Member
    Join Date
    Aug 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Difference between Interpreter and Compiler

    okay, I see. It depend on language to use.

    sip Greg Brannon, thanks for your explanation.

  6. #6
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Difference between Interpreter and Compiler

    Just to be complete, there are occasional compilers for languages that are typically interpreted, but I don't believe they've been reliably maintained for any length of time.

  7. #7
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: Difference between Interpreter and Compiler

    Quote Originally Posted by xturtle View Post
    Hello ChristopherLowe,

    Thanks for your advice. I have red several articles about them. The main point is the interpreter execute and translate the high level language into machine language line by line and show up if there is an error, but compiler execute all of codes and running it, and also show up if there is an error.

    one question from me,

    When we use interpreter and compiler ? because both same translate codes to machine language.

    Thanks,

    Not quiet correct. A compiled language turns the source code into native machine code which can be directly executed by the hardware. An interpreted language compiles the source code into something that can be read by an interpreter and then converted into machine code.

    For example, C is a compiled language. The gcc compiler converts .c files to executable binaries and as such you need to target the cpu architecture at compilation. Java on the other hand an interpreted language. The javac compiler turns .java file into bytecode called .class files. Then it's up to the Java runtime environment to interpret the bytecode and turn it into executable machine code on the fly.

    The advantage of the Java interpreted paradigm is you can leave native hardware details up to the JRE, whereas is C you typically compile separately for each target platform with a bunch of IFDEF's to handle different system architectures. The disadvantage of interpreted languages is that the users need special software, such as the JRE to run the program. There is also an (arguably inconsequential) performance overhead with interpreted languages compared to compiled ones because there is the extra step of interpretation.
    Computers are fascinating machines, but they're mostly a reflection of the people using them.
    -- Jeff Atwood

Similar Threads

  1. Need help to write an interpreter in Java
    By ua7872j in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 27th, 2013, 07:15 AM
  2. Creating an Interpreter?
    By tapp13 in forum Java Theory & Questions
    Replies: 4
    Last Post: October 11th, 2010, 05:25 PM
  3. BrainF*** interpreter
    By helloworld922 in forum The Cafe
    Replies: 1
    Last Post: April 29th, 2010, 02:36 PM