Given a sample code:
public class Test {
public static final String COOL = "boy";
public static void main(String[] args) {
Sub a = new Sub();
System.out.print(Test.COOL);
System.out.print(Sub.COOL);
System.out.print(a.COOL);
System.out.print(((Test) a).COOL);
}
}
class Sub extends Test {
public static final String COOL = "girl";
}
What will be the result? Choose the correct option?
(A) girl girl boy boy
(B) boy girl boy girl
(C) girl boy girl boy
(D) boy girl girl boy
(B)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.