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
Forwarded from S.O.P("قناة مناهج كلية تقنية المعلومات");
Composition is a feature of java, not a design technique but we can achieve it using Java code.
Anonymous Quiz
49%
True
51%
False
👍1
Forwarded from S.O.P("قناة مناهج كلية تقنية المعلومات");
The HAS-A relationship is based on ......., rather than ........ .
Anonymous Quiz
24%
Inheritance,usage.
53%
Usage, inheritance.
23%
None of the above
If a class is designed to be extended, it is better to provide a ....... constructor to avoid programming errors
Anonymous Quiz
60%
No-args
27%
Default
13%
Parameterized
Forwarded from S.O.P("قناة مناهج كلية تقنية المعلومات");
The relationship between the class and its superclass is known as the....
Anonymous Quiz
21%
AOK
21%
KOA
57%
AKO