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

Mapa mental

Object Oriented Programming: Java

Ashley Kreynin Inglés

Contenido del mapa

Object Oriented Programming: Java

  1. Class

    • Fields
      • Attributes/ variables within class
        • camel naming: ex. 'firstLetters'
          • Can be primitives or references to objects
            • If variable is not referencing an object, the value 'null' must be assigned to avoid error
              • '==' can be used to test if variable value is null
    • Methods
      • Define actions or functions
        • To declare a method:
          • returnType
            • methodName
              • (list of arguments)
                • Can be blank, or have one or more (comma separated) arguments within parenthesis
              • camel naming: 'firstLetter'
            • Either a primitive, object, or void
          • The method body is the code that performs the action
      • Main
        • Entry point to application (allows class to be evoked)
          • Only one class needs a main method per application
            • 'java' keyword is used when running class to pass arguments to main
              • Arguments (strings; space separated) are declared after className
                • java className arg1 arg2 arg3 ...
          • To declare method main:
            • public static void main (string[] args)
    • Coded template to create objects
      • 'class' keyword is used to declare a class
        • The name of the class (Pascal naming: ex. 'FirstLetters')
          • Braces flanking class body
      • class definition file must be saved by ClassName.java
    • Constructor
      • constructs an object
        • Looks like method w/o return value
          • Must have same name as the class
            • Compiler adds a constructor to the class if there are none.
              • Constructor arguments can be used to initialize the fields in the object
        • Each class must have at least one constructor
          • Constructor may have some, one, or no arguments
        • 'new' keyword followed by the constructor of the class used to create object
          • Created objects are often assigned to variables
      • Object
        • An objects methods and fields can be called by the reference variable and the method of field name connected with a period (.)
          • objectReference.methodName

Información

Descripción
Mapa Mental sobre Object Oriented Programming: Java, creado por Ashley Kreynin el 17/06/2019.
Creado por
Ashley Kreynin
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?