Please explain me the output:
class Tree {
private static
String tree = "tree ";
string getTree() {return tree; }
}
class Elm extends Tree {
private static String tree = "elm ";
public static void main(String [] args) {
new Elm().go(new Tree());
}
void go(Tree t) {
String s = new Elm().getTree();
System.out.println(s);
}
}
I want to know that since getTree() is inherited by class Elm then why it does not use its own tree variable.