ClassOne.java package com.abc.pkg1; public class ClassOne { private char var = ‘a‘; char getVar() {return var;} } ClassTest.java package com.abc.pkg2; import com.abc.pkg1.ClassOne; public class ClassTest extends ClassOne { public static void main(Stringargs) { char a = new ClassOne().getVar(); char b = new ClassTest().getVar(); } } What is the result?()
A. Compilation will fail.
B. Compilation succeeds and no exceptions are thrown.
C. Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
D. Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
查看答案
该试题由用户783****72提供
查看答案人数:37674
如遇到问题请
联系客服
正确答案
该试题由用户783****72提供
查看答案人数:37675
如遇到问题请联系客服