Java 2004 — A Tour for the Midrange Developer

Java Language Syntax

Next

Structure

  • Free Form, Block Based
  • public abstract class MyClass
    {
      protected int employeeID = new java.util.Random().nextInt();
     
      public int getEmployeeID()
      { return employeeID; } // end getEmployeeID()
     
      public void setEmployeeID( int employeeID )
      { this.employeeID = employeeID; } // end setEmployeeID()
    } // end class MyClass
    
  • Exceptions — throws and throw
  • try 
    { // some code... }
    catch( Exception e ) // can have catch for each exception type
    { // handle exception or throw to caller... }
    finally 
    { // clean up before return... }
    
  • Program Entry Point — main()
  • public static void main( String[] args )
    {
      MyClass mc = new MyClass();
      mc.setEmployeeID( 100 );
    } // end main
    


    Next