0
Will line 1 give me an error ? If yes, why?
Here's the code //code from pckg abc package abc; class Sup { protected int x;} //code in pckg xyz package xyz; import package abc; class Sub extends Sup { psvm (...){ Sup obj=new Sup () //line 1 obj.x=5;} }
1 Respuesta
0
yes, it will give error. Sub classes can access protected members but not through objects