¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Objects & Classes

Marissa Farmer Computer Science Inglés

Contenido del mapa

Objects & Classes

  1. Objects/Instance (Car)

    • Attributes/Fields
      • Color, Number of Tires, Plate Number
    • Actions/Methods
      • Run, Brake
    • Constructing Object/Instantiating Class- use new!
      • assign created object to object/reference variable
        • Type/Constructor objectReference = new Constructor();
        • if the reference variable does not have a value, assign null
          • test if reference variable is null using == ex.  if (book==null) {      book=new Book(); } System.out.println(book.title);
      • call an object/field using .
        • objectReference.methodName objectReference.fieldName
  2. Classes are blueprints to create objects

  3. Classes

    • class className{      [class body] }
    • Class Name
      • Capitalize the initial of each word (Pascal), same as constructor name!
        • Saving file: ClassName.java
    • Fields (Variables)
      • Capitalize initial of each word except the first (Camel) (Same for Methods)
      • Primitive or references to objects (other classes)
    • Methods
      • Declaration/Signature
        • return value, method name, list of arguments
          • syntax: returnType methodName (listOfArguments)
          • return type can be primative, an object, or void (return nothing)
      • Body
        • code to perform action
      • Main- method providing entry point to application (how to invoke a specific class)
        • signature: public static void main(String[] args)
        • Passing Arguments
          • java className arg1 arg2 arg3
            • arguments must be strings
    • Constructors
      • constructorName(listOfArguments){      [constructor body] }
      • used to construct an object, sometimes called a constructor method, no return value
      • constructor arguments are used to initialize fields in the object

Información

Descripción
Computer Science Mapa Mental sobre Objects & Classes, creado por Marissa Farmer el 20/05/2021.
Creado por
Marissa Farmer
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?