Mapa mental
Object-oriented Programming
Contenido del 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
Información
- Descripción
- Mapa Mental sobre Object-oriented Programming, creado por Rachel Johnson el 18/05/2020.
- Creado por
- Rachel Johnson · may 2020
- Actualizado
- 18 may 2020
- Visitas
- 0
- Valoración