O GoConqr está de visual novo! Conte para nós o que você achou.

Mapa mental

Objects & Classes

Marissa Farmer Computer Science Inglês

Conteúdo do 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

Informações

Descrição
Computer Science Mapa Mental sobre Objects & Classes, criado por Marissa Farmer em 20-05-2021.
Criado por
Marissa Farmer
Visualizações
0
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?