Anatomy of a Class

  • Any Java source file (.java)
    has this physical structure:

  • import statements;
    class definition {
        instance variable definitions;
        method definition (argumentList) {

           local variable definitions;
           statements;
        } // end of method definition
        // more methods ...
    } // end of class definition

  • A class is used to instantiate
    specific objects (each with possibly
    different values) in the heap
         ... new Button ("Help") ...