找考题网-背景图
单项选择题

现有:1.classBook{2.privatefinalvoidread(){System.out.print("book");}3.}4.classPageextendsBook{5.publicstaticvoidmain(String[]args){6.//insertcodehere7.}8.privatefinalvoidread(){System.out.print("page");}9.}和如下三个代码片段(x,y,z):x.//justacommenty.newPage().read();z.newBook().read();分别插入到第6行,有几个允许代码通过编译并可以运行且无异常?()
A.0
B.1
C.2
D.3

A.classBook{2.privatefinalvoidread(){System.out.print("book");}3.}4.classPageextendsBook{5.publicstaticvoidmain(String[]args){6.//insertcodehere7.}8.privatefinalvoidread(){System.out.print("page");}9.}和如下三个代码片段(x,y,z):x.//justacommenty.newPage().read();z.newBook().read();分别插入到第6行,有几个允许代码通过编译并可以运行且无异常?()
A.0
B.1
C.2
D.3
热门试题