Mapa mental
Object-oriented Programming
Conteúdo do mapa
Object-oriented Programming
Classes: template to create identical types of objects
- Objects: living, non-living, abstract, or concrete
- Attributes = fields
- Capitalize the initial of each word except the first one
- Actions = methods
- Capitalize the initial of each word except the first one
- returnType methodName (liistOfArguments)
- Ex: double getSalary ()
- Ex: int add (int a, int b)
- Ex: double getSalary ()
- use a period to call a method or field
- objectReference.methodName
- objectReference.fieldName
- see note for example code
- Employee employee = new Employee () employee.age = 24 employee.salary = 50000
- objectReference.methodName
- Attributes = fields
- class className { [class body] }
- class body contains fields and attributes
- Capitalize initial of each word of each class name
- Objects: living, non-living, abstract, or concrete
The Method Main
- Entry point into the application. Only one class needs it
- Passing arguments to main: java className arg1 arg2 arg3
- Must pass arguments as strings
Constructors: every class needs at least one
- Similar to a method but without a return value
- Must have same name as class
- constructorName (listOfArguments) { [constructor body] }
- One is assigned if you don't write one
Creating Objects
- 'New' command
- new Employee ()
- Employee employee = new Employee ()
- new Employee ()
- 'New' command
Informações
- Descrição
- Mapa Mental sobre Object-oriented Programming, criado por Rachel Johnson em 18-05-2020.
- Criado por
- Rachel Johnson · mai 2020
- Atualizado
- 18 mai 2020
- Visualizações
- 0
- Avaliação