Java-Web 程序员笔试题

2014-11-24 02:07:11 · 作者: · 浏览: 61

public class Servlet1 extends HttpServlet {


public String s1=”abc”;


public void doGet(HttpServletRequest request,HttpServletResponse response){


String s2=”def”;


HttpSession session=request.getSession();


}


}



class Value {


public int i = 15;


}


public class Test {


public static void main(String[] args) {


Test t = new Test();


t.first();


}


public void first() {


int i = 5;


Value v = new Value();


v.i = 25;


second(v, i);


System.out.println(v.i);


}


public void second(Value v, int i) {


i = 0;


v.i = 20;


Value val = new Value();


v = val;


System.out.println(v.i + ” ” + i);


}


}


boolean a = true;


boolean b = false;


boolean c = true;


if (a == true)


if (b == true)


if (c == true)


System.out.println(“Some things are true in this world”);


else


System.out.println(“Nothing is true in this world!”);


else if (a && (b = c))


System.out


.println(“It’s too confusing to tell what is true and what is false”);


else


System.out.println(“Hey this won’t compile”);


a.调用JspInit()方法 b.调用_jspService()方法 c.调用jspDestory()方法 d.网页解释 e.JSP编译 f.载入类 g.建立Servlet实体



public class XxxDao {


private int size;


public void setSize(int size) {


this.size = size;


}


public void method1(){


int t = size*100;


}


public void method2(int sizeA){


this.size = sizeA;


AnothorDao.anothorMethod(size);


}


}