Zusammenfassung der Ressource
Java language structure
- It is important to understand teh base terminology of Java
in terms of packags, classes and objects
- Package
- Java groups classes into functional packages.
- Without packages, a programmer may create a Java class called Test .
Another programmer may create a class with the same name. With the
usage of packages you can tell the system which class to call
- CLass
- Template that describes the data and behavior associated with
an instance of that class.
- In Java source code a class is defined by the class keyword and
must start with a capital letter. The body of a class is surrounded by
{}.
- Object
- Def.: An object is an instance of a class
- The object is the real element which has data and can
perform actions. Each object is created based on the class
definition.
- Object as superclass
- Every object in Java implicitly extends the Object class.
The class defines the following methods for every Java
object:
- equals(o1)
- allows checking if the current object is equal to o1
- getClass()
- returns the class of the object