单选题请在下列程序的横线处填入正确的语句。 import java.awt.*; import java.awt,event.*; public class ex16 { Frame f; TextArea ta; Button btn; public static void main(String[] args) { ex16 e = new ex16(); e.m(); } public void m() { f = new Frame("ex16"); ta = new TextArea(); btn = new Button("ok"); btn.addActionListener(new MyAction()); f.add(ta, "Center"); f.add(btn, "South"); f.setSize(100, 100); f.setVisible (true); } class MyAction implements ActionListener { ______ { System. out.println (ta. getText ()); } } }
单选题Java语言中所有的简单数据类型都被包含在______中。 A.java. sql B.java. awt C.java. lang D.java. math
单选题处理对象传输的接口是______。
A.Serializable
B.Cloneable
C.ItemListener
D.ActionListener
单选题下列代码的执行结果是
____
。
public class test5{
public static void main (String args[]){
String s1=new String("hello");
String s2=new String("hello");
System.out.prim(s1==s2);
System.out.print(",");
System.out.println(s1.equals(s2));
}
单选题Java对输入/输出访问所提供的同步处理机制是______。
A.字节流
B.过滤流
C.字符流
D.压缩文件流
单选题Swing允许按自己的要求选择组件的外观和感觉,Swing是通过哪一方法实现该功能的? ( )
单选题下面程序执行后,屏幕上显示的应是{{U}} {{/U}}。 public class
Test{ public static void main(String[ ]
args) {
char ch1[]={'B','e','i','j','i','n','g'};
char ch2[]={'B','e','i','j','i','n','g','2','0','0','8'};
String s1 = new String(ch1);
String s2 = new String(ch2, 0, 7);
System. out. println(sl. equals(s2)); }
}
A. true
B. false
C. Beijing
D. 编译错误
单选题阅读下面代码 if(x==0)System.out.printIn("冠军");) else if(x>-3)System.out.printIn("亚军"); elseSystem.out.printIn("季军"); 若要求打印字符串”季军”,则变量x的取值范围是______。
单选题当对象obj调用其类成员函数init()时,init()的this指向的是( )。
单选题下列属于Java核心包的一项是______。
单选题可以使当前同级线程重新获得运行机会的方法是【 】
单选题在函数调用过程中,如果函数funA调用了函数funB,函数funB又调用了函数funA,则( )。 A.称为函数的直接递归调用 B.称为函数的间接递归调用 C.称为函数的循环调用 D.C语言中不允许这样的递归调用
单选题下面程序段的输出结果是 public class Test{ public static void main(Stringargs[]){ int x,y; x=(int)Math.sqrt(5)/2+(int)Math.random()*5/2; y=(int)Math.sqrt(3)/2+(ht)Math.random()*3/2; if(x>y) System.out.println(”x>y”); else if(x=y) System.out.println(”x=y”); else System.out.Println(”x<y”); } }
单选题语句public String getEncoding()的功能是( )。
单选题下面关于Applet 的说法中正确的是( )。
单选题下列关于对象串行化的说法不正确的是 ( ) A) 可以通过ObjectOutputStream类的writeObject()方法将对象写到一个文件中 B) 可以通过ObjeetInputStream类的readObject()方法将一个文件中的对象读到内存中 C) Java中的对象都可以进行串行化 D) Java支持对象串行化的定制
单选题阅读下面程序 public class Test4 public static void main (String args[]) int i=10, j=3; float m=213.5f,n=4.0f System.out.printIn (i%j); System.out.printIn (m%n); 程序运行的结果是______。
单选题阅读下面代码 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(); 代码运行的结果是
单选题有以下程序: #include <stdio.h> main() int a[]=2,3,5,4),i; for(i=0;i<4;i++) switch(i%2) case 0:switch(a[i]%2) case 0:a[i]++;break; case 1:a[i]--; break; case 1:a[i]=0; for(i=0;i<4;i++) printf("%d",a[i]);printf("/n"); 程序运行后输出的结果是( )。 A.3 3 4 4 B.2 0 5 0 C.3 0 4 0 D.0 3 0 4
单选题有如下的代码段,当编译和运行时,下列各选项中说法正确的是______。
public class Z
{
public static void main(String args[])
{
new Z();
}
Z()
{
Z aliasl=this;
Z alias2=this;
synchronized(aliasl) {
try{
alias2.walt();
System.out.println("DONE WAITING");
}
catch(InterruptedException e) {
System.out.println("INTERR UPTED");
}
catch (Exception e) {
System.out.println("OTHER EXCEPTION");
}
finally{
System.out.println("FINALLY");
}
}
System.out.println("ALL DONE");
}
}