题目内容

对下列程序的叙述中,正确的是()。 1)public class X extends Thread implements Runnable{ 2)public void run{ 3)system.out.println("this is run"); 4)} 5)public static void main(String args[]){ 6)Thread t=new Thread(new X); 7)t.start; 8)} 9)}

A. 第l行会产生编译错误
B. 第6行会产生编译错误
C. 第6行会产生运行错误
D. 程序正常运行

查看答案
更多问题

阅读下列利用递归来求n!的程序。 class FactorialTest{ static long Factorial(int n){//定义Factorial方法 if(n= =1) return l; else return n*Factorial{ }; } public static void main{String a[]}{ //main方法 int n=8: System.out.println{n+"!="+Factorial (n)}; } } 为保证程序正确运行,在下画线处应该填入的参数是()。

A. n-1
B. n-2
C. n
D. n+1

下列各词语中加点字的读音全都不相同拘一项是 () 。

A. 喑哑 黑暗 韵脚 黯然失色
B. 调动 稠密 雕刻 民生凋敝
C. 稍微 讥诮 末梢 形销骨立
D. 租赁 狙击 阻止 神情沮丧

下面程序段的输出结果是()。 public class Test{ public static void main(String args[]){ int X,y; x=(int)Math.sqrt(5)/2+(int)Math.random*5/2; y=(int)Math.sqrt(3)/2+(int)Math.random*3/2; if(x>v) System.OUt.println("x>y"); elseif(x= =y) System.out.println("x=Y"); else System.out.println("x<y"): } }

A. x>y
B. x=Y
C. x<y
D. 编译错误

为了支持压栈线程与弹栈线程之间的交互与同步,在程序的下画线处依次填入的语句是()。 public class IntStack{ private int idx=0; private int[]data=new int[8]; public void push(int i){ data[idx]=i: idx++; … … }

A. synchronized notify
B. synchronized this.wait
C. synchronized this.notify
D. Serializable sleep

答案查题题库