Add to Chrome
✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Which is NOT a correct explanation of the code given below.
Lecturer lec = (Lecturer)objRef; lec.age = 21;
is an example of Downcasting
Person objRef = new Lecturer(); objRef.name = "Goo";
is an example of Upcasting
objRef.display(); lec.display();
outputs:LecturerLecturer
The code will not compile.
System.out.println(lec.name + "/" + lec.age);
outputs:
Goo/21
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!