Mapa mental
Object-Oriented Programming: Using real life situations to create a model to solve a problem
Conteúdo do mapa
Object-Oriented Programming: Using real life situations to create a model to solve a problem
Java object: has attributes (fields) and performs actions (methods)
- Java objects represent real-world objects but with less details
- To assign a created object with an object variable: Ex: Employee employee = new Employee();
- To call an objects methods or fields: objectReference.methodName objectReference.fieldName
- Java objects represent real-world objects but with less details
Java class: a tempate to create objects of similar types
- Syntax for a class: class className { [class body] }
- Each word in a class name is capitalized. ex: Employee, DateUtility
- Class file must be saved as className.java
- Syntax for a class: class className { [class body] }
Fields: variables that are primitive or references to other objects
- Should follow camel naming convention. Ex: age, maxAge
Methods: actions that an object can take
- Method declaration contains a return value, method name, and list of arguments
- Declaration syntax: returnType methodName {listofArguments}
- Return type void means that the method returns nothing
- ex: Address getAddress() // returns an address object
- Constructor method: Constructs the object and does not have a return value
- The compiler will add one for you if not defined
- Method declaration contains a return value, method name, and list of arguments
"main" provides the entry point to the application
- Syntax for the main class: public static void main {String[] args}
Informações
- Descrição
- Mapa Mental sobre Object-Oriented Programming: Using real life situations to create a model to solve a problem, criado por Aubrey Schnars em 28-05-2021.
- Criado por
- Aubrey Schnars
- Visualizações
- 0
- Avaliação