Given:
1. public class Base {
2. public static final String FOO = “foo”;
3. public static void main(String[] args) {
4. Base b = new Base();
5. Sub s = new Sub();
6. System.out.print(Base.FOO);
7. System.out.print(Sub.FOO);
8. System.out.print(b.FOO);
9. System.out.print(s.FOO);
10. System.out.print(((Base)s).FOO);
11. } }
12. class Sub extends Base {public static final String FOO=”bar”;}
What is the result?
A.
foofoofoofoofoo
B.
foobarfoobarbar
C.
foobarfoofoofoo
D.
foobarfoobarfoo
E.
barbarbarbarbar
F.
foofoofoobarbar
G.
foofoofoobarfoo