محاضرة أستاذ خالد هذا الاسبوع
مفهوم
super
final
override
upcasting
downcasting
مفهوم
super
final
override
upcasting
downcasting
class Main {
public static void main(String[] args) {
Child c = new Child(5);
}
class Parent {
Parent(int x) {
System.out.print("x");
}
Parent(String A) {
System.out.print(A);
}
}
class Child extends Parent {
Child(String name) {
super("10"); // استدعاء constructor of Parent with String parameter
System.out.print(name);
}
}
}شن الرن؟
تتبع اسئلة امتحانات