Mindmap
Object-oriented Programming (OOP)
Inhalt der Mindmap
Object-oriented Programming (OOP)
Java Object
- Fields (Attributes)
- Methods (Actions)
- Fields (Attributes)
Java Classes
- Classes create abstractation of problem
- When writing a class remember:
- Class name
- Fields
- Methods
- Fields
- Class name
- When writing a class remember:
- Classes create abstractation of problem
Fields
- Are variables - primitives or ref. to objects
- Object can contain other objects
- Field names follow camel naming convention
- Object can contain other objects
- Are variables - primitives or ref. to objects
Methods
- Define actions that a class's objects can do
- Declaration part + body
- Return can be primitive, an object, or void
- Two arguments can be separated by comma
- Define actions that a class's objects can do
The Method main
- Main provides entry point to application
- Main method allows class containing it to be invoked
- Arguments must pass as strings
- Main method allows class containing it to be invoked
- Main provides entry point to application
Constructors
- Every class must have one
- Used to construct object
- No return value, including a void
- Used to construct object
- Constructor can have 0 argument (no-arg)
- Used to initialize fields in object
- W/two constructors, you can pass values at same time as creating object
- Every class must have one
UML Class Diagrams
- Provides summary of all fields & methods
Creating Objects
- Can create object using the new keyword
- Use new followed by constructor of class
- assign created object to object variable
- Declare an object reference w/same type as object
- If you have object, you can call its methods and access its fields
- Use object reference that was assigned to object
- Can create object using the new keyword
The null Keyword
- Sometimes reference variable has no value - called null value
- If declaring local reference variable within method w/no object asssigned:
- Must assign null
- Can test for null with == operator
Informationen
- Beschreibung
- Mindmap am Object-oriented Programming (OOP), erstellt von Sarah Estes am 27/05/2021.
- Erstellt von
- Sarah Estes
- Aufrufe
- 0
- Bewertung