设为首页 加入收藏

TOP

新浪微博笔试题
2014-11-24 02:11:14 来源: 作者: 【 】 浏览:61
Tags:新浪 试题

不定项选择:


1. 不能用来修饰interface的有()


A.private B.public C.protected D.static


2.System.out.println(-1>>>1) 输出什么.


A.-1 B.1 C. 2147483647 D. -2147483647


3. 下列有关Servlet的生命周期,说法不正确的是()。


A、在创建自己的Servlet时候,应该在初始化方法init()方法中创建Servlet实例。


B、在Servlet生命周期的服务阶段,执行service()方法,根据用户请求的方法,执行相应的doGet()或是doPost()方法。


C、在销毁阶段,执行destroy()方法后系统立刻进行垃圾回收。


D、destroy()方法仅执行一次,即在服务器停止且卸载Servlet时执行该方法。


4. 关于异常处理机制的叙述哪些正确()


A. catch部分捕捉到异常情况时,才会执行finally部分


B. 当try区段的程序发生异常时,才会执行catch区段的程序


C. 不论程序是否发生错误及捕捉到异常情况,都会执行finally部分


D. 以上都是


下列程序有错误吗,错在那里


1.


public class Something {


void doSomething() {


private String s = “”;


int i = s.length();


}


}







2.


abstract class Something {


private abstract String doSomething ();


}







3.


public class Something {


public static void main(String[] args) {


Something s = new Something();


System.out.println(“s.doSomething() returns ” + doSomething());


}


public String doSomething() {


return “Do something …”;


}


}





4.


public class Something {


public static void main(String[] args) {


Other other= new Other();


new Something().addOne(other);


}


public void addOne(final Other other){


other.i++;


}


}


class Other{


public int i;


}





5.


interface A {


int x = 0;


}


class B {


int x = 1;


}


class C extends B implements A {


public void printX() {


System.out.println(x);


}


public static void main(String[] args) {


new C().printX();


}


}


编程题:


































】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇华为的技术面试 下一篇oracle面试之oracle api

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: