一、选择题
,此类继承了List接口,下列哪个方法是正确的( B )
A、 ArrayList myList=new Object(); B、 List myList=new ArrayList();
C、 ArrayList myList=new List(); D、 List myList=new List();
()方法使用哪种类型的参数( A )
A、 Graphics B、 Graphics2D C、 String D、 Color
( C )
A、 byte=128; B、 Boolean=null; C、 long l=0xfffL; D、 double=;
( B )
字符串不能变,数组可以变
public class Example{
String str=new String("good");
char[]ch={'a','b','c'};
public static void main(String args[]){
Example ex=new Example();
(,);
(+" and ");
();
}
public void change(String str,char ch[]){
str="test ok";
ch[0]='g';
}
}
A、 good and abc B、 good and gbc C、test ok and abc D、 test ok and gbc
, 会产生什么结果( A )
public class X extends Thread implements Runable{
应该是Runnable少了个n
public void run(){
("this is run()");
}
public static void main(String args[])
{
Thread t=new Thread(new X());
();
}
}
A、第一行会产生编译错误 B、第六行会产生编译错误
C、第六行会产生运行错误 D、程序会运行和启动
" "文件中读出第10个字节到变量C中,下列哪个方法适合? ( D )
A、 FileInputStream in=new FileInputStream(""); (9); int c=();
B、 FileInputStream in=new FileInputStream(""); (10); int c=();
C、 FileInputStream in=new FileInputStream(""); int c=();
D、 essFile in=new essFile(""); (9); int c=();
,哪种布局管理器的容器中的组件大小不随容器大小的变化而改变? ( B )
布局管理器 FlowLayout Panel的默认布局管理器
BorderLayout 分为东西南北中五个区域,每个区域最多一个组件
GridLayout 网格布局,将容器分为很多个网格
A、 CardLayout B、 FlowLayout C、 BorderLayout D、 GridLayout
:
public class Person{
static int arr[] = new int[10];
public static void main(String a[])
{
(arr[1]);
}
}
那个语句是正确的?
( C )
A、编译时将产生错误; B、编译时正确,运行时将产生错误;
C 、输出零; D、输出空。
?( A )
在JAVA中“\”是转义字符,所以要表示一个字符串“\”就要用“\\”两个连续的转义字符表示一个字符串“\”
A、\\ B、*\\ C、\’ D
《JAVA》模拟试题及答案 来自淘豆网m.daumloan.com转载请标明出处.