• Java Translation and Execution
  • Development Environments
  • Syntax and Semantics
  • Errors
  • Java Translation and Execution




    Download 225,5 Kb.
    bet9/10
    Sana22.07.2024
    Hajmi225,5 Kb.
    #268238
    1   2   3   4   5   6   7   8   9   10
    Bog'liq
    slides01

    Java Translation and Execution

    • The Java compiler translates Java source code into a special representation called bytecode
    • Java bytecode is not the machine language for any traditional CPU
    • Another software tool, called an interpreter, translates bytecode into machine language and executes it
    • Therefore the Java compiler is not tied to any particular machine
    • Java is considered to be architecture-neutral

    Java Translation and Execution

    • Java source
    • code
    • Machine
    • code
    • Java
    • bytecode
    • Java
    • interpreter
    • Bytecode
    • compiler
    • Java
    • compiler

    Development Environments

    • There are many development environments which develop Java software:
      • Sun Java Software Development Kit (SDK)
      • Borland JBuilder
      • MetroWork CodeWarrior
      • Microsoft Visual J++
      • Symantec Café
    • Though the details of these environments differ, the basic compilation and execution process is essentially the same

    Syntax and Semantics

    • The syntax rules of a language define how we can put symbols, reserved words, and identifiers together to make a valid program
    • The semantics of a program statement define what that statement means (its purpose or role in a program)
    • A program that is syntactically correct is not necessarily logically (semantically) correct
    • A program will always do what we tell it to do, not what we meant to tell it to do

    Errors

    • A program can have three types of errors
    • The compiler will find problems with syntax and other basic issues (compile-time errors)
      • If compile-time errors exist, an executable version of the program is not created
    • A problem can occur during program execution, such as trying to divide by zero, which causes a program to terminate abnormally (run-time errors)
    • A program may run, but produce incorrect results (logical errors)

    Download 225,5 Kb.
    1   2   3   4   5   6   7   8   9   10




    Download 225,5 Kb.