单项选择题
下面程序的输出结果是( )。
public class Sun
public static void main(String args[ ])
int n=4 ,sum=0;
while(n>0)
sum+=n;
n--;
System.out.println("sum is "+sum);
A.sum is 10
B.sum is 4
C.10
D.4
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
下面的哪些程序段可能导致错误 ( ) Ⅰ:String s= Gone with the wind ; String t= good ; String k=s+t; Ⅱ:String s= Gone with the wind ; String t; t=s[3]+ one ; Ⅲ:String s= Gone with the wind ; String standard=s.toUpperCase(); Ⅳ:String s= home directory ; String t=s- directory ;
A.Ⅱ、Ⅲ
B.Ⅱ、Ⅳ
C.Ⅰ、Ⅳ
D.Ⅲ、Ⅳ
点击查看答案&解析
单项选择题
在JavaApplet程序用户自定义的Applet子类中,一般需要重载父类的( )方法宋完成主类实例的初始化工作。
A.start()
B.stop()
C.init()
D.paint()
点击查看答案&解析
相关试题
下列JApplet对鼠标单击事件进行处理,当鼠...
变量名、 【14】 首单词小写,其余单词...
有如下代码段,请填写完整所缺的部分。 im...
Applet工作在图形方式下,向其中绘图、显示...
Java图形用户界面编程中的最基本组成部分是...