Sie sind auf Seite 1von 1

Chapter 1 Definitions

method definitions the two parts of a class definition that contains public void method call - A command of the form someObject.someMessage() Executors and instances an object created by a class Inherit - allows any SmartTurtle object to use all of the regular Turtle methodsin addition to those
directly defined in the SmartTurtle class

Superclass the most basic, original class subclass - the classes derived from commands in the superclass object design deciding what methods are needed in a subclass to accomplish a task

A main method is a sequence of instructions normally initiated from the terminal window. The main method is normally called by java Whatever in the terminal window, where the Whatever class contains that main method. Its heading must be public static void main (String[ ] args) (except args could be any name you like). A method without static in the heading is an instance method, specifying a sequence of actions carried out by its executor. An instance method is typically called by putting an object value in front of the method name, separated by a dot. That object value must refer to an instance of the class the method belongs to, or a subclass of that class. A method definition has two parts: the method heading (everything up to but not including the first left brace) and the method body (the matched pair of braces and its contents).

Language elements A CompilableUnit can be: public class ClassName { DeclarationGroup } or: public class ClassName extends ClassName { DeclarationGroup } A DeclarationGroup is any number of consecutive Declarations. A Declaration can be: public static void main ( String [ ] args ) { StatementGroup } or: public void MethodName ( ) { StatementGroup } A StatementGroup is any number of consecutive Statements. A Statement can be: ClassName VariableName ; e.g., Turtle sam; or: VariableName = new ClassName ( ) ; e.g., sam = new Turtle(); or: VariableName . MethodName ( ) ; e.g., sam.drawFlower();

Das könnte Ihnen auch gefallen