The BASE for JAVA LEARNING

by PRO FE S S OR


SECTION I: STEP 1

WHAT'S JAVA? and WHY JAVA?


JAVA is a an Indonesian island.

JAVA is a slang word for Coffee.

JAVA is a chicken breed of black plumage.

JAVA is an Object-Oriented, Portable High Level Language.


CHARACTERISTICS OF JAVA

  • OBJECT-ORIENTED: Many languages claim that they are Object-Oriented. In some Object-Oriented Languages (as C++) you still can write code that does not follow object-orientation. JAVA on the other hand is a total Object-Oriented Language, as Encapsulation is required for coding.
  • PORTABILITY: By having a JVM (Java Virtual Machine), the compiled code is interpreted when executed.
  • This characteristic makes a program written for one system works exactly the same on anothre system.
  • It follows the WORA principle (Written Once, Run Anywhere).
    • SIMPLICITY: By not having pointer arithmetic, JAVA has done what C++ promised but did not delivered. It has achieved the simplicity desired by most programmers. This appeals to most programmers as:
  • The coding task is sped up.
  • Code tracing is easier, and thus easy to maintain.
    • SECURITY: JAVA allows for security issues to be resolved. Classes in JAVA can implement Information Hiding, and access permissions are controlled.

    • STABILITY: JAVA implements a Garbage Collection Method which cleans up unnecessary objects, as memory resources become low. This allows for a great stability in code execution.

    • MULTI-THREADING: JAVA allows the processing of several threads from within one program. This characteristic is very convenient in many applications (i.e. GUI development). It is worth to say that this feature is not available in other Object-Oriented languages such as C++.


    WHY JAVA?

    • Based on the characteristics above, we can see WHY JAVA is becoming one of the most popoular languages in the industry.


    • It is also becoming very popular in the academia.
    • JAVA is utilized in different technology environments: web development, e-commerce, client-server netowrks, and many others.
    • Other flavors of JAVA are: JE22, JMS, JDBC, JSP, JNDI, Servlets, Applets, EJB, JavaBeans, JNI .

    Click here to go to the JAVA Mini-Course page

    The BASE for JAVA LEARNING

    by PRO FE S S OR


    SECTION I: STEP 2

    JAVA File Names, Compilation, and Execution



    JAVA FILE NAMES and CHARACTERISTICS

    Note: You can have more than one class in a file, in which case and if the 'main' method is contained within any of the classes of that file, the name of the file must be the name of that class that contains the 'main' method. If there is no main method in any class of that file, then any class name can be used for the file. However, if you have multiple classes in one file, be aware that ONLY the class with the same name of the file can be made 'public'. (to be discussed under "Visibility Modifiers".) Usually the class containing the main method is made public.

    >>> In a typical project, a class is associated with its own file (same name), that is, there are few instances of multiple classes per file. <<<

    JAVA CODE COMPILATION, and EXECUTION

    The following Table depicts the most popular Instructions used from the Command Prompt line:
    (keywords are lowercase)

    Instruction Keyword

    Task Performed

    Field(s)

    Example

    Result

    javac

    Compiles JAVA source code

    JAVA Source File Name (.java)

    javac Hello.java

    Generates .class file

    java

    JVM Interprets and Executes
    JAVA compiled code
    called BYTECODE (.class)

    JAVA Class name
    (as appears in source code)

    java Hello

    Code is executed.

    javadoc

    It generates help files
    in .html format.
    Top file generated: index.html

    JAVA Class name
    (as appears in source code)

    javadoc Hello

    .html help files are generated.


    Click here to go to the JAVA Mini-Course page