

Declarations and Access Control - Programming
Q1:
package testpkg.p1;
public class ParentUtil
{
public int x = 420;
protected int doStuff() { return x; }
}
package testpkg.p2;
import testpkg.p1.ParentUtil;
public class ChildUtil extends ParentUtil
{
public static void main(String [] args)
{
new ChildUtil().callStuff();
}
void callStuff()
{
System.out.print('this ' + this.doStuff() ); /* Line 18 */
ParentUtil p = new ParentUtil();
System.out.print(' parent ' + p.doStuff() ); /* Line 20 */
}
}
|


For help Students Orientation
Mcqs Questions
One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.