----------------------------------------------------------------
Что выведет данная программа?
public class StaticTest {
private int a = 0;
private static int b = 0;
private int c = 0;
public StaticTest() {
a++;
b++;
c = b;
}
@Override
public String toString() {
return a + " " + b + " " + c;
}
public static void main(String[] args) {
StaticTest p0 = new StaticTest();
System.out.println(p0.toString());
StaticTest p1 = new StaticTest();
System.out.println(p1.toString());
StaticTest p2 = new StaticTest();
System.out.println(p2.toString());
//
System.out.println(p0.toString());
System.out.println(p1.toString());
System.out.println(p2.toString());
}
}
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
Что выведет данная программа?
public class StaticTest {
private int a = 0;
private static int b = 0;
private int c = 0;
public StaticTest() {
a++;
b++;
c = b;
}
@Override
public String toString() {
return a + " " + b + " " + c;
}
public static void main(String[] args) {
StaticTest p0 = new StaticTest();
System.out.println(p0.toString());
StaticTest p1 = new StaticTest();
System.out.println(p1.toString());
StaticTest p2 = new StaticTest();
System.out.println(p2.toString());
//
System.out.println(p0.toString());
System.out.println(p1.toString());
System.out.println(p2.toString());
}
}
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------