Code:
class Winkel
{ double Alpha;
public Winkel (double alpha)
{ Alpha=alpha;
}
public String toString ()
{ return ""+Alpha;
// einfache Umwandlung von double zu String
}
}
was ich nicht verstehe: wieso eine methode tostring, wenn sie nirgendswo aufgerufen wird ?
oder erfolgt das aufrufen erst im Hauptprogramm : Winkel w = new ( winkel )
system.out.println(w.toString)
geht nciht auch system.out.println(w.Alpha) ?