Chapter 1

      Early computers and machine language

    Any computer can directly understand only its own machine language

      Assembly languages

    Translated directly into machine language by an assembler

      High-level languages

    Types of translators:  Compilers and Interpreters

    History of C and C++

      The Internet and the WWW

    Java and platform independence

      Typical Java Development Environment

 

The Java environment

     A text editor is used to record the high level java program in ASCII code

  We will use BlueJ

  A file with .java extension is created; it is in ASCII code

     A java compiler translates the .java file into bytecode

  The compiler we use is the JDK (Java Development Kit)

  A file with .class extension is created; it is in bytecode

     A bytecode interpreter translates the .class file into the machine language for the its specific machine

  The bytecode must be loaded into RAM before it is interpreted

  As the bytecode is loaded, the bytecode verifier checks to make sure it does not violate any security restriction.

 

The Java Platform summary

      First the source code is compiled into bytecode.

      On the local machine an interpreter reads the bytecode and translates it into machine language for that specific machine.

   It is easier to write an interpreter for the Java bytecodes than it is to write a compiler for the Java source code

       This interpreter is included in modern browsers so that they can interpret bytecodes (i.e. run an applet)

 

Applications and Applets

      Applets

   programs that can be embedded in HTML documents.

   HTML has tags specifically designed for Java applets

      Applications

   Traditional programs that can run stand-alone from the command line or a GUI

   In Java, a main method is included in a class to make it an application

 

Getting started with Java

      The Java Development Kit (JDK) is provided free from Sun, who developed Java

      The user interface to the JDK is not great

      BlueJ is a editor that uses the JDK; it provides a GUI, designed especially for education

      There is a BlueJ tutorial (31 pages) provided by the developers of BlueJ, available for download free

    It is in Adobe Acrobat format.

 

Downloads

      If you have a machine, you should download the JDK and BlueJ

      The versions on the disk supplied with your text of the JDK and BlueJ are not the latest versions

      The latest versions, which can be downloaded from the Internet.

      See Resources on the home page for download links

 

 

Test-Driving a Java Application

      Page 16-20 of your text

      Your text tells you how to run the application using the command line

      An alternate way is to use BlueJ

    Open BlueJ

    Click on Project, then Open non BlueJ

    Find the program

    Use appJ instead of the program in Chapter 1

    The Chapter 1 version has only the .class files, not the .java files which BlueJ needs

    Compile the program

    To execute a program in BlueJ, you must know which class contains the main method

    Since it stated on the command line with ATMCaseStudy, that is the one