下面选项中,类的声明方式正确的是()
A. publicvoidAA{…}
B. publicclassMove(){…}
C. publicclassvoidnumber{…}
D. publicclassCar{…}
阅读下列代码: publicclassTest{ intcount=9; publicvoidcount1(){ intcount=10; System.out.println("count1="+count); } publicvoidcount2(){ System.out.println("count2="+count); } publicstaticvoidmain(Stringargs[]){ Testt=newTest(); t.count1(); t.count2(); } } 编译运行后,输出结果是()
A. count1=9count2=9
B. count1=10count2=9
C. count1=10count2=10
D. count1=9count2=10
在java中,以下程序的输出结果是() classPoint{ intx; booleany; voidoutput(){ System.out.println(x); System.out.println(y); } publicstaticvoidmain(String[]args){ Pointpt=newPoint(); pt.output(); } }
A. 运行错误
B. 0ture
C. 0false
D. 00
在Java中,提供了4种访问级别,以下访问控制级别由小到大顺序排列正确的是()
A. private、default、protected、public
B. default、public、protected、private
C. private、default、public、protected
D. protected、public、private、default