题目内容 (请给出正确答案)
[主观题]

阅读下面程序class Test implements Runnable {public static void main(String[] args) {Test t

阅读下面程序 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.程序编译通过,且运行正常

提问人:网友ningjing 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“阅读下面程序class Test implements Ru…”相关的问题
第1题
阅读下面程序public class Test implements Runnable{public static void main(String[]args){__

阅读下面程序 public class Test implements Runnable{ public static void main(String[]args){ _______________________________________; t. start(); } public void mR(){ System. out. println("Hello!"); }} 在程序下画线处填入正确选项是

A.Test t=flew Test()

B.Thread t=new Thread();

C.Thread t=new Thread(new Test());

D.Test t=new Thread();

点击查看答案
第2题
阅读下面程序public class Test implements Runnable { public static void main(String[] args)

阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start(); } public void run() { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是

A.Test t=new Test();

B.Thread t=new Thread();

C.Thread t=new Thread(new Test());

D.Test t=new Thread();

点击查看答案
第3题
阅读下面Applet程序import javax.swing.*:import java.awt.*:public Class Test SwingApplet ext

阅读下面Applet程序 import javax.swing.*: import java.awt.*: public Class Test SwingApplet extends JApplet { JLabel 1=new JLabel("This is a Swing Applet."); public void init() { ______ } } 程序中下画线处应填入的正确选项是

A.Container contentPane=getContentPane();contentPane.add(1);

B.Jpanel contentPane=new JPanel();contentPane.add(1);

C.contentPane.add(1);

D.add(1);

点击查看答案
第4题
阅读下面程序public class ExampleStringBuffer {public static void main(String[] args) {Stri

阅读下面程序 public class ExampleStringBuffer { public static void main(String[] args) { StringBuffer sb=new StringBuffer("test"); System.out.println("buffer="+sb); System.out.println("length="+sb.length()); } } 程序运行结果中,在“length=”后输出的值是

A.10

B.4

C.20

D.30

点击查看答案
第5题
请阅读下面程序public class Test {public static void main (String[] args) {int i,j;for (i=1

请阅读下面程序

public class Test {

public static void main (String[] args) {

int i,j;

for (i=1;i<5;i++) {

for (j=1;j<=i;j++)

system.out.print (i+"X"+j+"="+i*j+" ");

System.out.println();

}

}

}

程序执行完后,i循环和j循环执行的次数分别是【 】。

点击查看答案
第6题
阅读下面程序class Test implements Runnable{public static void main(String[] args){Tes

阅读下面程序

class Test implements Runnable{

public static void main(String[] args){

Test t = new Test();

t.start();

}

public void run(){ }

}

下列关于上述程序的叙述正确的是

A) 程序不能通过编译,因为 start() 方法在 Test 类中没有定义

B) 程序编译通过,但运行时出错,提示 start() 方法没有定义

C) 程序不能通过编译,因为 run() 方法没有定义方法体

D) 程序编译通过,且运行正常

点击查看答案
第7题
请阅读下面程序 public class ExampleStringBuffer{ public static void main(String[]args){

请阅读下面程序 public class ExampleStringBuffer{ public static void main(String[]args){ StringBuffer sb=new StringBuffer("test"); System.OUt.println("buffer="+sb); System.OUt.println("length="+sb.length );}} 程序运行结果中在"length="后输出的值是()。

A.10

B.4

C.20

D.30

点击查看答案
第8题
请阅读下面程序 public class ExampleStringBuffer{ public static void main(String[]args){

请阅读下面程序 public class ExampleStringBuffer{ public static void main(String[]args){ StringBuffer sb=new StringBuffer("test"); System.OUt.println("buffer="+sb); System.OUt.println("length="+sb.length );}} 程序运行结果中在"length="后输出的值是()。

A.10

B.4

C.20

D.30

点击查看答案
第9题
阅读下面代码public class Test implements Runnable { public void run(Thread t) { System.ou

阅读下面代码 public class Test implements Runnable { public void run(Thread t) { System.out.println("Running"); } public static void main(String[] args) { Thread tt=new Thread(new Test()); tt.start(); } } 代码运行的结果是

A.将抛出一个异常

B.没有输出并正常结束

C.输出“Running”并正常结束

D.程序第2行将出现一个编译错误

点击查看答案
第10题
阅读下面代码class Test implements Runnable { public int run() { int i=0; while(true) {

阅读下面代码 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

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信