/ **
* 10道题系列会持续更新,每日的10道题都是我做过的,做错或者觉得需要复习的有价值的
*请关注我,每日和我一同进步,有更好的建议或有问题的请在评论区提出或私信我
* /
1.有一个源代码,只包含import java.util.* ; 这一个import语句,下面叙述正确的是? ( )
A.只能写在源代码的第一句B.可以访问java/util目录下及其子目录下的所有类
C.能访问java/util目录下的所有类,不能访问java/util子目录下的所有类
D.编译错误
2.在 JAVA 编程中, Java 编译器会将 Java 程序转换为( )
A.字节码
B.可执行代码
C.机器代码
D.以上都不对
3.要使某个类能被同一个包中的其他类访问,但不能被这个包以外的类访问,可以( )
A.让该类不使用任何关键字
B.使用private关键字
C.使用protected关键字
D.使用void关键字
4.下列的哪个选项可以正确用以表示八进制值8?()
A.0×8
B.0×10
C.08
D.010
5.以下选项中,合法的赋值语句是()
A.a>1;
B.i++;
C.a= a+1=5;
D.y = int ( i );
6.下面程序的输出是:()
String x="fmn";
x.toUpperCase();
String y=x.replace('f','F');
y=y+"wxy";
System.out.println(y);
A.FmNwxy
B.fmnwxy
C.wxyfmn
D.Fmnwxy
7.public class NameList
{
private List names = new ArrayList();
public synchronized void add(String name)
{
names.add(name);
}
public synchronized void printAll() {
for (int i = 0; i < names.size(); i++)
{
System.out.print(names.get(i) + ””);
}
}
public static void main(String[]args)
{
final NameList sl = new NameList();
for (int i = 0; i < 2; i++)
{
new Thread()
{
public void run()
{
sl.add(“A”);
sl.add(“B”);
sl.add(“C”);
sl.printAll();
}
} .start();
}
}
}
Which two statements are true if this class is compiled and run?
A.An exception may be thrown at runtime.
B.The code may run with no output, without exiting.
C.The code may run with no output, exiting normally(正常地).
D.The code may rum with output “A B A B C C “, then exit.
E.The code may rum with output “A B C A B C A B C “, then exit.
F.The code may ruin with output “A A A B C A B C C “, then exit.
G.The code may ruin with output “A B C A A B C A B C “, then exit.
8.下列正确的有( )
A.call by value不会改变实际参数的数值
B.call by reference能改变实际参数的参考地址
C.call by reference不能改变实际参数的参考地址
D.call by reference能改变实际参数的内容
9.下列方法中哪个是线程执行的方法? ()
A.run()
B.start()
C.sleep()
D.suspend()
10.ResultSet中记录行的第一列索引为?
A.-1
B.0
C.1
D.以上都不是