题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-20 01:42:18

[单项选择]阅读下列程序:class ThreadTest extends Thread{ public static void main(String[]args){ Thread t=new Thread(this); t.start( ); } public void run( ){ System.out.print("A thread test."); }} 对该程序而言,正确结论是 ( )
A. 该程序能够通过编译并打印输出“A thread tes”
B. 该程序能够通过编译,但运行时将不调用ThreadTest类中的run()方法,因此不产生任何输出
C. 该程序存在编译错误,因为在main()方法中不能使用this指针
D. 上述选项都不正确

更多"阅读下列程序:class ThreadTest extends Thr"的相关试题:

[单项选择]下列程序的输出结果是( )。 public class Test
public static void main(String[] args)
char a1 = 'B', a2 = 'c';
if(a1+1<a2) ++a1;
System. out. println(a1);


A. B
B. b
C. C
D. c
[单项选择]下面程序段的输出结果为 public class MyClass { public static void main(String args[]) { String s="Hello! How are you"; System.out.println(s.LastIndexOf("o",16); } }
A. 16
B. o
C. u
D. 17
[单项选择]下列程序的执行结果是   public class Testdd {    public static void main (String args[ ]){     int a=l0,b=4,c=20,d=6;       System.out.println(a++*b+c,--D) ;    }   }
A. 300
B. 1200
C. 140
D. 144
[单项选择]

阅读下面程序
class Test implements Runnable {
public static void main(String[] args) {
Test t = new Test( );
t.startO;
}
public void run( ){ }
}
下列关于上述程序的叙述正确的是()


A. 程序不能通过编译,因为start()方法在Test类中没有定义
B. 程序编译通过,但运行时出错,提示start()方法没有定义
C. 程序不能通过编译,因为run()方法没有定义方法体
D. 程序编译通过,且运行正常
[单项选择]在执行下面这段Java程序时: public class Test { public static void main (String[] args) { String s1=args[0]; String s2=args[1]; String s3=args[2]; } }若编译程序后键入命令: java Test one two three,那么变量s1所引用的字符串为( )。
A. null
B. test
C. one
D. java
[单项选择]执行下面程序后输出的正确结果是 Public class Test { public static void main(String args[]){ byte x=3,y=4; long r=80L; System.out.print(r/y); System.out.print(”,”); System.out.print(x/y); } }
A. 20.0,1
B. 20.0,1.0
C. 20,0
D. 20,1.0
[单项选择]下列程序执行后,chl的值是 public class Testccc{ public static void main(Stringargsr[]) { char chl='A',ch2='T'; if(chi十5 System.out.println(chl); } }
[单项选择]下列程序运行的结果是( )。 public class Test { public static void main(String[] args) { int a=2,b=3; System. out. println( (a>b" *** a =" :" ###b = ") + A) ; } }
A. *** a=2
B. *** a=3
C. ### b=2
D. ### b=3
[单项选择]下面程序的运行结果是( )。 public class Test { public static void main (String args[]) { int c=5; System. out. println (c); System. out. println (c++); System. out. println (c); } }
A. 5 6 6
B. 5 5 6
C. 6 7 7
D. 6 6 6
[单项选择]下列程序输出的结果为( )。 public class Test { public static void main (String[] args){ int a=3,b=4,c=5,d=6,e=7; if(a<b||c>d) e++; else e--; System.out.println(e); } }
A. 8
B. 7
C. 6
D. 9
[单项选择]下列程序的执行结果是( )。 public class Test { public static void main(String args[]) { byte y=4; long r=80L; System.out.println(r/y); } }
A. 20B
B. 20
C. 20.0
D. 编译错误
[单项选择]下面程序的输出结果是( )。 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
[单项选择]执行下面程序后,结果是   public class Testrr {     public static void main(String args[]){      int i=0xFFFFFFF1;      int j=-i;      System.out.println("j="+j);    }   }
A. j=-15
B. j=-16
C. j=16
D. j=15
[单项选择]以下程序的输出结果为( )。 public class Main { public static void main(String[] args) { int i=0, j=0, a=6; if((++i>0)||(++j>0)) a++; System. out. println( "i=" +i+", j ="+j+", a="+A) ; } }
A. i=0, j=0, a=6
B. i=1, j=1, a=7
C. i=1, j=0, a=7
D. i=0, j=1, a=7
[单项选择]下面程序的输出结果为( )。 public class Test { public static void main (String args[]) { String X="ABCD"; String Y="EFG"; X=X.substring (X.length( )-Y.length( )); System.out.println(X); } }
A. ABC
B. BCD
C. EFG
D. ABCDEFG

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码