Question: PLZ help with the following IN JAVA Given the following code (where the function FunTest() and the main method are inside one class in the
PLZ help with the following IN JAVA
Given the following code (where the function FunTest() and the main method are inside one class in the same file where classes X, Y and Z are), predict what is the output?

class X{ protected int i; public X() { i=10; private void myfun() { System.out.println("Number 1"); } } class Y extends X{ void myfun() { System.out.println("Number 2"); i=20; System.out.println("i is: "+i); } } class Z extends Y{ protected void myfun () { System.out.println("Number 3"); i=30; System.out.println("i is: "+i); public class Q13 { public static void FunTest(Object objl) { Z zl = (Z)objl; zl. myfun(); Y yl = zl; yl.myfun(); public static void main(String[] args) { Z zobj = new ZO; FunTest(zobj); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
