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

Mindmap

Java Class

Saketh Maganti Englisch

Inhalt der Mindmap

Java Class

  1. The class name

    • A class definition must be saved in a file that has the same name as the class name
    • General Syntax: class className{ [classbody] }
    • Class names capitalize the initial of each word.
  2. The fields

    • Fields are variables. They can be primitives or references to to objects.
    • Field names also follow the camel naming convention
    • Ex. Address address;
  3. The methods

    • Methods define actions that a class's objects (or instances) can do
    • Methods have a declaration part and a body
      • The declaration consists of a return value, the method name, and a list of arguments. It is also called the signature of the method.
      • The body contains code that performs the action
    • Syntax: returnType methodName (listOfArguments)
    • The method "main"
      • The method main is a special method that provides the entry point to an application
      • Only one class can have a main method. This method allows the class containing it to be invoked.
      • Signature of main method: public static main void(String[] args)
  4. Java Classes are a blueprint or a template to create objects of an identical type.

  5. Constructors

    • Every class must have at least one constructor. Otherwise, no objects would be created out of the class.
    • Constructors are used to construct an object. If your don't define a constructor, then the compiler adds one for you.
    • A constructor looks like a method and is sometimes called a constructor method. However, it doesn't have a return value.
    • Must have the same name as the class.
    • Syntax: constructorName (listOfArgurments) { [constructor body] }
    • A constructor may have a zero argument, in which it is called a no-argument constructor
    • Constructor arguments can be used to initialize the fields in the object
  6. Objects

    • Objects have attributes and can perform actions.

Informationen

Beschreibung
Mindmap am Java Class, erstellt von Saketh Maganti am 29/08/2019.
Erstellt von
Saketh Maganti · Aug 2019
Aktualisiert
29 Aug 2019
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck