Sie sind auf Seite 1von 1

basic syntax for a class definition: accessModifier class ClassName AccessModifiers are: private,protected,public notes: classes are usually

kept public Attributes of a class: Two types of attributes: instance variables, class variable syntax of instance variables: accessModifier dataType identifier notes: instance variables are usually kept private notes: A class has : Attributes, and Operations also known as Methods or functi ons Invoking method using reference variable: Storing a method in a variable, and invoking it: Identifier = referenceVariableName.methodName() notes: the Identifier has to be declared and as the be the same type. or just: invoking a method: referenceVariableName.methodName() Method definition: accessModifier static returnType methodName() notes: all other method definitions are non-static, meaning without the word sta tic; accessModifier returnType methodName() OR accessModifier returnType methodName(dataType variable) notes: Static refers to the fact that the method is shared by all objects belong ing to the class

Das könnte Ihnen auch gefallen