每日10道JAVA题(20180625)

89 篇文章 2 订阅

/ **   
 * 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.以上都不是
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

StrideBin

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值