Hallo,
folgende Aufgabe:
Was gibt dieses Programm aus? Ergebnis ist 12. Mir ist noch nicht so ganz klar wie man darauf kommt.
folgende Aufgabe:
Was gibt dieses Programm aus? Ergebnis ist 12. Mir ist noch nicht so ganz klar wie man darauf kommt.
Java:
public class Beispiel {
static int i = 21;
public void setI(int value) {
i = value;
}
public static void main(String[] args){
for(int i=1; i<=2; i++)
new Beispiel().setI(i+10);
System.out.println(new Beispiel().i);
}
}