首页 > 公务员考试
题目内容 (请给出正确答案)
[主观题]

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

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“阅读下面程序class Test implements Ru…”相关的问题
第1题
阅读下面程序 public class Increment{ public static void main(stringargs[]){ int C; c=5

阅读下面程序 public class Increment{ public static void main(stringargs[]){ int C; 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

点击查看答案
第2题
阅读下面程序public class Increment } public static void main(String args[]) { int c; c=5

阅读下面程序 public class Increment } public static void main(String args[]) { int c; 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

点击查看答案
第3题
阅读下面程序,写出输出结果。#include using namespace std ; class A { int a, b; public :
阅读下面程序,写出输出结果。#include using namespace std ; class A { int a, b; public :

阅读下面程序,写出输出结果。

#include using namespace std ; class A { int a, b; public : A() { a = b = 0; }

A(int aa, int bb) { a = aa; b = bb; cout << a << ' ' << b << endl ; } }; int main() { A x, y(2,3);

return 0; }

点击查看答案
第4题
阅读下列代码public class Test 2005{public static void main(String args[]){ System.out.prin

阅读下列代码 public class Test 2005{ public static void main(String args[]){ System.out.println((3>2)?4:5); } } 其运行结果是

A.2

B.3

C.4

D.5

点击查看答案
第5题
给出下面代码的输出()public class Test {public static void main(String[ ] args) {int[][]

A.0

B.1

C.2

D.4

点击查看答案
第6题
以下程序调试结果为:public class Test {int m=5;public void some(int x) {m=x;}public stati

以下程序调试结果为:

public class Test {

int m=5;

public void some(int x) {

m=x;

}

public static void main(String args []) {

new Demo().some(7);

}

}

class Demo extends Test {

int m=8;

public void some(int x) {

super.some(x);

System.out.println(m);

}

}

A.5

B.8

C.7

D.无任何输出

E.编译错误

点击查看答案
第7题
下列程序test类中的变量e的最后结果为()。public class test{ public static void main (String a

下列程序test类中的变量e的最后结果为()。 public class test { public static void main (String args[]) { int a=10; int b; int c; if(a>50) { b=9; } c=b+a; } }

A.10

B.0

C.19

D.编译出错

点击查看答案
第8题
假设test类运行于多线程环境下,那么关于A处的同步下面描述正确的是? ()public class Test {Li

假设test类运行于多线程环境下,那么关于A处的同步下面描述正确的是? ()

public class Test {

List list= new java.util.ArrayList();

public void test() {

synchronized (list) { // --A

list.add(String.valueOf(System.currentTimeMillis()));

}

}

}

A.test方法中必须增加synchronized

B.Test类为singleton时有必要增加synchronized

C.test方法中没有必要增加synchronized

D.Test类为singleton时也没有必要增加synchronized

点击查看答案
第9题
阅读下列程序,请写出该程序的功能。import java.awt.*;import javax.swing.*;public class Cla

阅读下列程序,请写出该程序的功能。

import java.awt.*;

import javax.swing.*;

public class Class32

{public static void main(String[] args)

{

JFrame. frame=new JFrame("登录对话框");

TextField id=new TextField(12);

TextField pw=new TextField(12);

JButton login=new JButton("登录");

JButton cancel=new JButton("取消");

pw.setEchoChar('*');

frame.setLayout(new GridLayout(3,2));

frame.add(new JLabel("ID:",JLabel.RIGHT));

frame.add(id);

frame.add(new JLabel("密码:",JLabel.CENTER));

frame.add(pw);

frame.add(login);

frame.add(cancel);

frame.pack();

frame.setVisible(true);

}

}

点击查看答案
第10题
阅读下列程序,请写出该程的功能。import java.io.*;public class Class34{public static void
阅读下列程序,请写出该程的功能。import java.io.*;public class Class34{public static void

阅读下列程序,请写出该程的功能。

import java.io.*;

public class Class34

{

public static void main(String[] args)

{

File inputFile=new File("file1.txt");

File utputFile=new File("file2.txt");

int ch;

try

{

FileReader in=new FileReader(inputFile);

FileWriter ut=new FileWriter(outputFile);

while((ch=in.read())!=-1)out.write(ch);

in.close();out.close();

}

catch(FileNotFoundExceptione1)}

{System.out.println("文件没有找到!"+e1);}

catch(IOException e2)

{System.out.println("FilereadError!"+e2);}

}

}

点击查看答案
第11题
阅读下列程序,写出程序功能。import j avax. swing. *;public class C3501{public static void

阅读下列程序,写出程序功能。

import j avax. swing. *;

public class C3501

{

public static void main(String[] args)

{

JFrame. myWin=new JFrame("C3501") ;

myWin. setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE. ;

JMenuBar j mb=new JMenuBar() ;

myWin. setJMenuBar(j mb) ;

myWin. setBounds(100, 200, 300, 300) ;

JMenu j m=new JMenu("AAA") ;

j mb. add(j m) ;

JMenuItem j mi=new JMenuItem("AA1") ;

j m. add(j mi) ;

JMenu j m2=new JMenu("AA2") ;

j m. add(j m2) ;

JMenuItem j mi2=new JMenuItem("AA21") ;

j m2. add(j mi2) ;

myWin. setVisible(true) ;

}

}

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改