ClassOne.java:1.packagecom.abe.pkg1;2.publicclassClassOne{3.privatecharvar=‘a’;4.chargetVar(){returnvar;}5.}ClassTest.java:1.packagecom.abe.pkg2;2.importcom.abc.pkg1.ClassOne;3.publicclassClassTestextendsClassOne{4.publicstaticvoidmain(String[]args){5.chara=newClassOne().getVar();6.charb=newClassTest().getVar();7.}8.}Whatistheresult?()A.Compilationfails.B.Compilationsucceedsandnoexceptionsarethrown.C.Anexceptionisthrownatline5inClassTest.java.D.Anexceptionisthrownatline6inClassTest.java.

ClassOne.java:1.packagecom.abe.pkg1;2.publicclassClassOne{3.privatecharvar=‘a’;4.chargetVar(){returnvar;}5.}ClassTest.java:1.packagecom.abe.pkg2;2.importcom.abc.pkg1.ClassOne;3.publicclassClassTestextendsClassOne{4.publicstaticvoidmain(String[]args){5.chara=newClassOne().getVar();6.charb=newClassTest().getVar();7.}8.}Whatistheresult?()

A.Compilationfails.

B.Compilationsucceedsandnoexceptionsarethrown.

C.Anexceptionisthrownatline5inClassTest.java.

D.Anexceptionisthrownatline6inClassTest.java.


相关考题:

ClassOne.java1.packagecom.abc.pkg1;2.publicclassClassOne{3.privatecharvar=‘a’;4.chargetVar(){returnvar;}5.}ClassTest.java1.packagecom.abc.pkg2;2.importcom.abc.pkg1.ClassOne;3.publicclassClassTestextendsClassOne{4.publicstaticvoidmain(String[]args){5.chara=newClassOne().getVar();6.charb=newClassTest().getVar();7.}8.}Whatistheresult?()A.Compilationwillfail.B.Compilationsucceedsandnoexceptionsarethrown.C.Compilationsucceedsbutanexceptionisthrownatline5inClassTest.java.D.Compilationsucceedsbutanexceptionisthrownatline6inClassTest.java.