class Shape {
Shape(int size) {
System.out.println("Shape constructor called with size = " + size);
}
}
class Circle extends Shape {
Circle(int radius) {
System.out.println("Circle constructor called with radius = " + radius);
}
}
public class Main {
public static void main(String[] args) {
Circle circle = new Circle(5);
}
}ايرور، كمبايلر مفش super
👍1
class A {
private int x = 0;
A() {
x++;
System.out.println(x);
}
A(int x, int y) {
System.out.println(x + y);
}
}
class B extends A {
private int x = 17;
B() {
System.out.println("(" + 2 + ", " + 2 + ")");
}
B(int x, int y) {
super(x, y);
}
}
public class programs5 {
public static void main(String[] args) {
B obj = new B();
}
}
تجمع شيتات واسئلة oop
نظري اسئلة امتحانات
حسيت في حاجات مش شورنا صح؟
Forwarded from S.O.P("قناة مناهج كلية تقنية المعلومات");
في interface، لما بنعرفوا متغير، ضروري نعطوه قيمة و إلا حيعتبر compile time error، و السبب علشان أنه static.
❤2