Mapa mental
Class
Conteúdo do mapa
Class
Blueprint for an Object
- Object (requires class)
- Living
- Persons
- Pets
- Not-living
- Cars
- Houses
- Concrete
- Books
- Television
- Abstract
- Love
- Knowledge
- Tax Rate
- Creating Objects (instance)
- Create=Construct=Instantiate
- to create an Employee object
- new Employee ();
- Living
- Object (requires class)
Needs Methods
- Define actions that a class's objects can do
- Method Main
- Provides entry point to an application
- signature of main
- public static void main(String[] args)
- Passing an argument to main
- java className arg1 arg2 arg3 ...
- arguments passed as Strings
- java Test 1 safeMode
- Method Main
- declaring a method:
- returnType methodName (listOfArguments)
- Return Type
- primitive
- object
- null
- Return Type
- If method takes more than one argument, arguments separated by comma
- int add (int a, int b)
- returnType methodName (listOfArguments)
- method that returns an address object
- Address getAddress
- method that accepts an argument
- int negate(int number)
- Define actions that a class's objects can do
Class definition saved same name as class name
Has fields
- age
- maxAge
- address
- validAddress
- numberOfRows
Constructors (all classes must have them
- constructorName (listOfArguments) ( [Constructor body]
- arguments used to initialize fields
Null Keyword
- If a reference doesn't have a value, it has a null value
- Book book // book is null
- If object is not assigned:
- Book book = null
- If a reference doesn't have a value, it has a null value
Informações
- Descrição
- Mapa Mental sobre Class, criado por Andy Gil em 21-05-2021.
- Criado por
- Andy Gil
- Visualizações
- 0
- Avaliação