GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Objects and Classes in Java

Diego Vargas Englisch

Inhalt der Mindmap

Objects and Classes in Java

  1. Java Object

    • Definition: A model that represents a real situation used to solve the main problem. An object consists of attributes (fields) and actions (methods/functions)
      • Fields
        • Fields define certain characteristics of the object. They are variables that can be primitives or even references to another object.
        • Fields follow the camel naming convention: age, maxAge, name, lastName, etc.
      • Methods
        • Methods define the actions the object can take. It consists of a a declaration and a body. The declaration has a return value, the method name, and a list of arguments. The body contains the code that performs the action.
          • returnType methodName (listOfArguments)
            • The return type can be a primitive, object, or void. Void means the method returns nothing
        • The Method Main
          • The method main acts as the entry point to an application. It allows the class containing it to be invoked.
  2. Java Class

    • Definition: A class serves as the template used to create an instance of an objects of identical type. The three main things a class should contain is the class name, the object's fields, and the object's methods.
      • class className { [class body] }
      • Class names follow the Pascal naming convention: Boss, PostOffice, StudentGrades, etc.
      • A class definition must be saved in a file that has the same name with the java extension. For example: Employee.java for the employee class.
      • A UML diagram is a useful way to conceptualize a class. It is a rectangle separated into three parts: the class name, the list of fields, and the list of methods.
      • Constructors
        • A constructor is used to construct an object. Every class must have at least one constructor or else the class is useless. Their syntax is similar to that of a method but has no return value.
        • A constructor with zero argument is called a no argument constructor. Constructor arguments can be used to intialize the fields in an object
        • constructorName (listOfArguments) { [constructor body] }

Informationen

Beschreibung
Mindmap am Objects and Classes in Java, erstellt von Diego Vargas am 21/05/2021.
Erstellt von
Diego Vargas
Aufrufe
1
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck