Mind map
FirstTask

Map content
FirstTask
classes are the fundamental building blocks of a Java program and determine what kind of objects you get
- a general syntax:
the features of objects
- attributes are called fields - optional
- actions are called methods - optional the object is able to perform
- a method has a declaration part and a body
- the declaration part consists of a return value, the method name, and a list of arguments
- the body contains code that perform the action
- a general syntax
- the return type of a method can be a primitive, an object, or void void - the method returns nothing
- a special method called main
- the signature of the main method
- pass arguments to main: type arguments after the class name e.g. to pass two arguments, "1" and "safeMode" when running the Test class
- a method has a declaration part and a body
- methods and fields capitalize the initial of each name, except the first word e.g. macAge - Camel naming convention
class names capitalize the initial of each name e.g. DataUtility - Pascal naming convention
UML class diagrams: the topmost part - the class name, the middle part - the list of fields, and the bottom part - the list of methods
an object can contain other objects if the class of the former contains variables that reference to the latter
every class have at least one constructor
- a constructor
- does not have return value
- must have the same name as the class
- may have zero argument (no-arg)
- a general syntax
- a constructor
create objects
- to create an Employee object: new Employee () ;
- to assign an object variable: Employee employee = new Employee () ;
- to call a method or a field by using a period: objectReference . methodName objectReference . fieldName
- creates an Employee object and assigns values to its age and salary fields
a reference variable refers to an object
- a reference variable does not have value, which is not referencing an object
- declare a local reference variable within a method but do not assign an object to it, need to assign null to it to satisfy the compiler
- a reference variable does not have value, which is not referencing an object
Images and files in the map
Information
- Description
- Mind Map on FirstTask, created by Chen Belinda on 15/01/2020.
- Created by
- Chen Belinda
- Views
- 1
- Rating






