16. العملي المثال
:
class A{
void sum(int x,int y){
System.out.println("in class A: x+y="+(x+y));
}
}
class B extends A{
void sum(int x,int y){
System.out.println("in class B: x+y="+(x+y));
}
public static void main(String[] args) {
B oo=new B();
oo.sum(10,20);
}
}
تكون سوف للبرنامج المخرجات
:
in class B: x+y=30
التاليه بالتجربه قم
:
الكالس داخل توجد التي الداله احذف
B
من تالحظه سوف مالذي البرنامج ونفذ
مخرجات
(
ليست هذة العمليه طبعا
overriding
)
الـ عن سؤال تحلونه لكي سؤال اعطيكم سوف االن
overriding
هو السؤال
:
Write java program that use overriding method in two classes one of them is A and the other is B
inhrites A ? (use two methods)