What will be the output when the following code is executed?
```
public class A {
public void print() {
System.out.println("A");
}
}
public class B extends A {
public void print() {
System.out.println("B");
}
}
public class C extends B {
public void print() {
System.out.println("C");
}
}
public class Main {
public static void main(String[] args) {
A obj = new C();
obj.print();
}
}
```