相关题目
在使用JavaBean的代码片断中
以下代码是为运行带别名myservlet 的servlet用的:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Hello extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType(“text/html”);
PrintWriter out = res.getWriter();
out.println(“”);
System.out.println(“Welcome”);
out.println(“”);
}
}
当你调用此servlet 时,其输出将是什么?
你使用 HTTPSession接口来跟踪你的servlets中会话数据。为把值加入到此会话对象,你应使用哪个函数?
ServletConfig 类用作什么?
在Servlet程序中,service()方法将完成什么操作?
下列代码的输出结果是 : ( )
class Parent{
void printMe() {
System.out.println("parent");
}
};
class Child extends Parent {
void printMe() {
System.out.println("child");
}
void printall() {
super.printMe();
this.printMe();
printMe();
}
}
public class Test_this {
public static void main(String args[]) {
Child myC=new Child();
myC.printall();
}
}
编写和运行Java applet程序与编写和运行Java application程序不同的步骤是:( )
下面的程序创建了一个文件输出流对象,用来向文件test.txt中输出数据,假设程序当前目录下不存在文件test.txt,编译下面的程序Test.java后,将该程序运行3次,则文件test.txt 的内容是( )。
import java.io.*;
public class Test {
public static void main(String args[]) {
try {
String s="ABCDE";
byte b[]=s.getBytes();
FileOutputStream file=new FileOutputStream("test.txt",true);
file.write(b);
file.close();
}catch(IOException e) {
System.out.println(e.toString());
}
}
}
如果需要从文件中读取数据,则可以在程序中创建哪一个类的对象( )
当点击鼠标或者拖动鼠标时,触发的事件是下列的哪一个?( )
