class one {
public void print_geek(){
System.out.println("Geeks");
}
}
class two extends one {
public void print_for() {
System.out.println("for");
}
}
public class Main {
public static void main(String[] args){
two g = new two();
one h = g;
g.print_geek();
h.print_for();
g.print_geek();
}
}
While trying to run the above code I am getting error:
"error: cannot find symbol
h.print_for();
^
symbol: method print_for()
location: variable h of type one "
Despite h and g being same object. I having hard time understanding what is the issue here?