public class MyMainClass extends MyAbstractClass{
public static void main(String a[]){
MyMainClass myMain=new MyMainClass();
System.out.println(myMain.getPrivateVariable());
System.out.println(myMain.getPrivateMethod());
}
}
abstract class MyAbstractClass {
private int y=20;
private int myPrivateMethod(){
return y;
}
public int getPrivateVariable(){
return y;
}
public int getPrivateMethod(){
return myPrivateMethod();
}
}
No comments:
Post a Comment