Programmiersprachen I

Programmiersprachen I
Wintertrimester 1998


Übungen
    Übungsblatt 10
      Aufgabe 24: Verstehen Sie die Klassenmechanismen von Java anhand der folgenden Beispiele:
      • Klasse mit einigen Methoden: Class1.java,
      • Methodenüberladung: Class2.java,
      • Statische Methoden: Static2.java,
      • Konstruktoren: Constructor1.java,
      • Statische Initialisierung: Constructor2.java,
      • Selbstreferenzen: This.java,
      • Nested Top-Level Classes: Class3.java, The next example program illustrate that a nested top-level class can access the static variables of the encloding class and also that a nested top-level class can contain a nested top-level class: StringCounter.java, Class4.java,
      • Member Classes: Class5.java,
      • Member Classes --- this: Class6.java,
      • Member Classes --- new: Class7.java,
      • Local Classes: The first example shows how a local class can access variables from the enclosing scope and the enclosing obvject: Class8.java. The second example modifues the first to use an inerface to which the local class conforms, allowing a reference to a local class object to be returned from the method declaring the class. A method is called for the local object after the scope in which it was created has gone out of scope: Class9.java,
      • Anonymous classes: Class10.java,
      • Interfaces: InterfaceTest.java

      Alle Beispiele entstammen dem Buch Developing Java Software von Russel Winder und Graham Roberts

      Aufgabe 25: Informieren Sie sich über Pizza.

      Aufgabe 26: Informieren Sie sich über Juice.

Arne Bayer
Wolfram Kahl
Last modified: Mon Feb 9 16:49:37 MET 1998