I am trying to understand what I am doing wrong with this code but I don't find the answer. Why it does not print anything in the compiler?
Please help. Thanks in advance.
public class ClassA {
int x = 0;
int y = 1;
public void methodA() {
System.out.println( "x is " + x + " , and y is " + y) ;
System.out.println( "I am an instance of: " + this.getClass().getName() ) ;
}
}
class ClassB extends ClassA {
int z = 3;
public static void main(String[] args) {
ClassB obj1 = new ClassB();
obj1.methodA();
}
}