每日10道JAVA题(20180723)

/**
 * 10道题系列会持续更新,每日的10道题都是我做过的,做错或者觉得需要复习的有价值的
 * 请关注我,每日和我一同进步,有更好的建议或有问题的请在评论区提出或私信我
 */

1.非抽象类实现接口后,必须实现接口中的所有抽象方法,除了abstract外,方法头必须完全一致.
A.正确
B.错误

2.JDK中提供的java、javac、jar等开发工具也是用Java编写的。()
A.正确
B.错误

3.下面有关java基本类型的默认值和取值范围,说法错误的是?
A.字节型的类型默认值是0,取值范围是-2^7—2^7-1
B.boolean类型默认值是false,取值范围是true\false
C.字符型类型默认是0,取值范围是-2^15 —2^15-1
D.long类型默认是0,取值范围是-2^63—2^63-1

4.Which method is used by a servlet to place its session ID in a URL that is written to the servlet’s response output stream?
A.The encodeURL method of the HttpServletRequest interface.
B.The encodeURL method of the HttpServletResponse interface.
C.The rewriteURL method of the HttpServletRequest interface.
D.The rewriteURL method of the HttpServletResponse interface.

5.下面有关spring的依赖注入,说法错误的是?
A.依赖注入通常有如下两种:设置注入和构造注入:
B.构造注入可以在构造器中决定依赖关系的注入顺序,优先依赖的优先注入
C.当设值注入与构造注入同时存在时,先执行设值注入,再执行构造注入
D.设值注入是指IoC容器使用属性的setter方法来注入被依赖的实例。这种注入方式比较简单、直观

6.void waitForSignal()
{
    Object obj = new Object();
    synchronized(Thread.currentThread())
    {
        obj.wait();
        obj.notify();
    }
}
Which statement is true?
A.This code may throw an InterruptedException
B.This code may throw an IllegalStateException
C.This code may throw a TimeOutException after ten minutes
D.This code will not compile unless”obj.wait()”is replaced with”(Thread)obj).wait()”
E.Reversing the order of obj.wait()and obj.notify()may cause this method to complete normally

7.package Wangyi;
class Base
{
    public void method()
    {
        System.out.println("Base");
    } 
}
class Son extends Base
{
    public void method()
    {
        System.out.println("Son");
    }
     
    public void methodB()
    {
        System.out.println("SonB");
    }
}
public class Test01
{
    public static void main(String[] args)
    {
        Base base = new Son();
        base.method();
        base.methodB();
    }
}
问这个程序的输出结果。
A.Base SonB
B.Son SonB
C.Base Son SonB
D.编译不通过

8.以下表达式中,正确的是()
A.byte i=128
B.boolean i=null
C.long i=0xfffL
D.double i=0.9239d

9.下面有关java classloader说法正确的是()?
A.ClassLoader就是用来动态加载class文件到内存当中用的
B.JVM在判定两个class是否相同时,只用判断类名相同即可,和类加载器无关
C.ClassLoader使用的是双亲委托模型来搜索类的
D.Java默认提供的三个ClassLoader是Boostrap ClassLoader,Extension ClassLoader,App ClassLoader
E.以上都不正确

10.Java程序的种类有( )
A.类(Class)
B.Applet
C.Application
D.Servlet

扫描二维码关注公众号,回复: 2462747 查看本文章

猜你喜欢

转载自blog.csdn.net/stridebin/article/details/81162868