logo

Crowdly

What is the output of the following program? class   Parent{       void  P...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

What is the output of the following program?

  1. class  Parent{  
  2.    void PrintData() {  
  3.       System.out.println("method of parent class");  
  4.    }  
  5. }  
  6.   
  7. class Child extends Parent {  
  8.    void PrintData() {  
  9.       System.out.println("method of child class");  
  10.    }  
  11. }  
  12. class UpcastingExample{  
  13.    public static void main(String args[]) {  
  14.         
  15.       Parent obj1 = (Parent) new Child();  
  16.       Parent obj2 = (Parent) new Child();   
  17.       obj1.PrintData();  
  18.       obj2.PrintData();  
  19.    }  
  20. }  
0%
0%
0%
Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.medtech.tn?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!