Answer is YES.
public class MySubClass extends MySuperClass {
public static void main(String a[]){
MySubClass mySubClass=new MySubClass ();
System.out.println(mySubClass.getPrivateVariable());
}
}
class MySuperClass {
private int y=20;
public int getPrivateVariable(){
return y;
}
}
output is:
20
No comments:
Post a Comment