10 likes | 169 Views
Test 5. Perekonnanimi. Eesnimi. Objetorienteeritud programmeerimine 2008/2009 kevadsemester E 12-14 ruum L203. public class A{ private int a; private int b; public A(int c){ a = c; b = c*c*c; } public String toString(){return a + " , " + b;} }.
E N D
Test 5 Perekonnanimi Eesnimi • Objetorienteeritud programmeerimine • 2008/2009 kevadsemester • E 12-14 ruum L203 public class A{ private int a; private int b; public A(int c){ a = c; b = c*c*c; } public String toString(){return a + ", " + b;} } public class B extends A{ private int c; public B(int a, int c){ super(a); this.c = c; } public String toString(){return super.toString() + "; " + c;} } public class C{ public static void main(String[] args){ B b = new B(3, 13); System.out.println(b); } } Väljastatakse konsoolile: 3, 27; 13 Pöördele: arvamused, ettepanekud, soovid