GoConqr has a new look! Let us know what you think.

Mind map

Chapter 4: Objects and Classes

Jovain Sterling English

Map content

Chapter 4: Objects and Classes

  1. Classes

    • Objects/Instance
      • Fields (Attributes)
        • int age; double salary; string position
        • references to objects
          • maxAge, validAddress,age
      • Methods (Actions or Functions)
        • work (); receiveSalary ()
        • define actions
        • declaration/signature of the method
          • consists of: return value, method name, and list of arguments
          • returnType methodName (listofArguments)
        • body
          • contains code that perform the action
        • return type: can be a primitive, an object, or void
          • void: nothing
        • accepts an argument:
          • int negate (int number)
        • does not accept arguments:
          • double getSalary ()
        • two or more arguments
          • int add (int a, int b)
        • main method
          • public static void main (String [ ] args)
          • java className arg1 arg2 arg3
      • creating objects:
        • new Employee () ;
        • Reference Variable
          • assign created object to a reference variable
            • Employee employee = new Employee () ;
              • employee is an object reference of type Employee
          • null keyword
            • when a reference variable does not have a value
            • Book book = null
      • objectReference.methodName
      • objectReference.fieldName
    • class Employee {
    • constructor
      • must have at least one
      • same name as class
      • no return value or void
      • constructorName (listofArguments) { [constructor body] }

Information

Description
Mind Map on Chapter 4: Objects and Classes, created by Jovain Sterling on 27/05/2021.
Created by
Jovain Sterling
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?