Friday, 9 October 2015

Static polymorphism using private method in java


public class First {

public static void main(String[] args) {
// TODO Auto-generated method stub
Second obj = new Second();
obj.show1();
}

}


public class Second {
private void show(){
System.out.println("Private method");
}

void show1(){
show();
}
}

output:-
Private method


No comments:

Post a Comment