下列程序的输出结果是______。 class T44 implements Runnable { public void run() { System.out.print in (Thread.currentThread ( ).getName ( ) + "运行" ); } } public class ex44 { public static void main(String[] args) { Thread t1 = new Thread(new T44(), "t1"); Thread t2 = new Thread(new T44 () , "t2"); t1 .setPriority(Thread. MAX_PRIORITY); t2.setPriority(Thread.MIN_PRIORITY); t2. start (); t1 .start (); } }
A.t1 运行 t2 运行
B.t2 运行 t1 运行
C.t1 运行 t1 运行
D.t2 运行 t2 运行
第1题:
请将下列程序的横线处补充完整,使得输出结果为bbaa
include<iostream>
using namespace std;
class A{
public:
______{cout<<"aa";}
};
class B:public A{
public:
~B(){cout<<"bb";}
};
int main(){
B*p=new
第2题:
阅读下列代码段。
上述代码的编译结果是( )。
A.程序通过编译并且run( )方法可以正常输出递增的i值
B.程序通过编译,调用run( )方法将不显示任何输出
C.程序不能通过编译,因为while的循环控制条件不能为“true”
D.程序不能通过编译,因为run( )方法的返回值类型不是void
第3题:
阅读下列代码段 class TestimplementsRunnable{ publicintrun(){ inti=0; while(true){ i++; System.out.println("i="+1); } } } 上述代码的编译结果是( )。
A.程序通过编译并且run()方法可以正常输出递增的i值
B.程序通过编译,调用run()方法将不显示任何输出
C.程序不能通过编译,因为while的循环控制条件不能为“true”
D.程序不能通过编译,因为run()方法的返向值类型不是void
第4题:
阅读下列代码段。 class Test implements Runnable{ public int run{ int i=0: while(true){ i++: System.OUt.println("i="+i); } } } 上述代码的编译结果是( )。
A.程序通过编译并且run方法可以正常输出递增的i值
B.程序通过编译,调用run方法将不显示任何输出
C.程序不能通过编译,因为while的循环控制条件不能为“true”
D.程序不能通过编译,因为run方法的返回值类型不是void
第5题:
下面程序的输出结果是( )。 #include <iostream> using namespace std; class A { public: A( ) {cout<<"A";} } class B { public: B() {coat<<"B" ;} } class C: public A { public: B b; C() {cout<<"C";} } void mian(){ C c; }
A.CBA
B.ABC
C.ACB
D.BCA
第6题: