Hallo!
Hier zuerst einmal der Code:
Wenn ich das Programm starte, gibt es mir "MoinMoin" zurück.
Wieso gibt es nicht "HalloMoin" aus. Was mache ich falsch?
Danke für Hilfe
Hier zuerst einmal der Code:
Code:
public class ListeEigenesElement {
static LinkedList <Element> Liste = new LinkedList <Element>();
public static void main(String[] args) {
Liste.add(new Element("Hallo"));
Liste.add(new Element("Moin"));
Iterator I = Liste.iterator();
while (I.hasNext()){
Element Temp = (Element) I.next();
String Ausgabe = Temp.GetContent();
System.out.print(Ausgabe);
}
}
}
class Element {
static String Content = null;
public Element(String pContent) {
SetzeContent(pContent);
}
void SetzeContent(String pContent) {
Content = new String(pContent);
}
String GetContent() {
return Content;
}
}
Wenn ich das Programm starte, gibt es mir "MoinMoin" zurück.
Wieso gibt es nicht "HalloMoin" aus. Was mache ich falsch?
Danke für Hilfe