网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
在j2ee中,有如下代码在servlet1.java中 Important javax.servelt.*; Important javax.servlet.http.* Import java.io.ioexception Import java.io.printwriter Public class servlet1 extends httpservlet{ Public void init() throws serveltexception{ } Public void service(httpservelt request request,httpserbletresponse response)throws servletexception,ioexception{ Printwriter out=response.getwriter(); Out.println(“hello”); } } 假如编译serblet 要具备的环境都已经建立好,现在用完全正确的命令编译该文件,对于以下陈述正确的是()
- A、编译该文件时会提示缺少doget()或者dopost()方法,编译不能够成功通过
- B、编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,会看到输出文字:“hello”
- C、编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,却看不到任何输出的文字
- D、编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,却看到产生运行时错误的出差信息
参考答案
更多 “ 在j2ee中,有如下代码在servlet1.java中 Important javax.servelt.*; Important javax.servlet.http.* Import java.io.ioexception Import java.io.printwriter Public class servlet1 extends httpservlet{ Public void init() throws serveltexception{ } Public void service(httpservelt request request,httpserbletresponse response)throws servletexception,ioexception{ Printwriter out=response.getwriter(); Out.println(“hello”); } } 假如编译serblet 要具备的环境都已经建立好,现在用完全正确的命令编译该文件,对于以下陈述正确的是() A、编译该文件时会提示缺少doget()或者dopost()方法,编译不能够成功通过B、编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,会看到输出文字:“hello”C、编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,却看不到任何输出的文字D、编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,却看到产生运行时错误的出差信息” 相关考题
考题
下面的Applet获取了相对于getDocumentBase()方法返回的目录路径为graph/java.gif的图像文件,并将它显示出来。在下面程序的划线处填入相应的语句。import java.awt.*;import java.applet.Applet;public class Test extends Applet {Image img;public void init() {【 】}public void paint (Graphics g) {g.drawlmage (img,30,25,this);}}
考题
下列Applet程序中,指定s为字符串类型,将s绘制在屏幕上,请将程序补充完整。import java.applet.Applet;import java.awt.Craphics;public class testl8_1 extends Applet {______String s;public void init (){s=new String("Hello World");}public Void______(Graphics g) {g.______(s,10,25);}}
考题
下列Applet在坐标 ( 20,20) 处显示一幅GIF图像,在横线处填入正确的语句。import java. net.*;import java. awt.*;import java. applet.*;public class Test extends Applet {Image IMG;public void init() {URL url = getDocumentBase ();String name="IMG.gif";【 】}public void paint(Graphics g) {g. drawImage ( IMG,20,20,this);}}
考题
本题的功能是监听键盘敲击事件,并将敲击的字符显示在标签上。开始,文字标签提示“Please press your keyboard!”,当按下键盘上的字符键,文字标签就变为“*ispressed!”(*为所按字母)。 import java.awt.*; import java.awt.event*’; import javax.swing.*; public class java2 extends Frame { Dublic static void main(String args[]){ java2 f=new java2("java2"); Panel pan=new Panel; f.init; } public java2(String str){ super(str); } public void init{ addWindowListener(new WindowAdapter{ public void windowClosing(WindowEvent e){ System.exit(0); } }); setSize(200,200); setLayout(new FlowLayout); lab=new Label("Please press your keyboard!"); add(lab); addKeyListener(this); setVisible(true); } public void keyTyped(KeyEVent e){ lab.setText("\"+ +"\ is pressed!"); repaint; } public void keyPressed(KeyEVent e){ ) public void keyReleased(KeyEvent e){ } private Label lab; }
考题
下面Applet在窗口中实现一个不可编辑的TextField,并且显示“ok”。在横线处填入正确的语句。import java.applet.Applet;import java.awt.t;public class Test extends Applet {TextField tf;public void init () {setLayout (new GridLayout(1,0);tf=new TextField("ok");【 】add(tf);}}
考题
下列程序构造了一个 Swing Applet ,请在下划线处填入正确的代码Import javax.swing.*;Import java.awt.*;Public class SwingApplet extends 【 13 】 {Jlabel l = new Jlabel ( “ This is a Swing Applet. ” );Public void init(){Container contentPane = getContentPane();contentPane.add(1);}}
考题
下列代码的输出结果是( )。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{public static void main(String args[]){child myc=new child();myc.printall();}}A.import java.awt.*;B.import java.applet.applet;C.import java.io.*;D.import java, awt.graphics;
考题
下列Applet实现键盘事件处理,当一个键按下时,判断是否为26个英文字母,并输出该字母。选择正确的语句填入横线处。 import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class ex34 extends Applet { String str = ""; public void init() { addKeyListener (new KeyAdapter (} { ______ { char ch; ch = ke.getKeyChar(); if((ch >= 'a' ch <= 'z') || (ch >= 'A' ch <= 'Z')) str = "字母:"+ ch; else str ">"不是字母"; repaint(); } }); requestFocus(); } public void paint(Graphics g) { g.drawString(str, 50, 50); } }A.public void keyPress(KeyEvent ke)B.public void keyTyped(KeyEvent ke)C.public void keyTyped(Event ke)D.public void keyPressing(KeyEvent ke)
考题
下面程序构造了一个Swing Applet,在下画线处填入正确的代码。import javax.swing.*;import java.awt.*;public class SwingApplet extends ______ {JLabel 1=new JLabel("This is a Swing Applet.");public void init() {Container contentPane=getContentPane();contentPane.add(1);}}
考题
下列代码的下画线处应填入的方法名是( )。 import java.awt.*; import java.applet.*; public class Hello extends Applet{ public void (Graphics g){ 9.drawstring("How are you!",l0,10); } }A.repaintB.printlnC.paintD.show
考题
请在下划线处填入代码,使程序能够正确运行。import java .awt.*;import java .applet.*;public class SayHi extends Applet{public void【 】(Graphics g){g .drawString(“Hi!”20,20);}}
考题
在J2EE中,有如下代码在Servlet1.Java中 Import javax.servlet.*; Import javax.servlet.http.* Import java.io.IOException; Import java.io.PrintWriter; Public class Servlet1 extends HttpServlet{ Public void init () throw ServletException {} Public void service(HttpServletRequest request, HttpServletResponce response) throws ServletException,IOException{ PrintWriter out=response.getWriter(); Out.println(“hello!”); } } 假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下成熟正确的是() A、编译该晚间时会提示缺少doGe()t或者doPost(),编译不能够成功通过B、编译后,把Serlvet.cass放在正确的位置,在浏览器中查看该Servlet1,会看到输出文在:“hello!”C、编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看不到任何输出的文字D、编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息
考题
在J2EE中,有如下代码在Servlet1.java中。 import javax.servlet.*; import javax.servlet.http.*; import java.io.IOException; import java.io.PrintWriter; public class Servlet1 extends HttpServlet { public void init() throws ServletException { } public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("hello!"); } } 假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下陈述正确的是()。 A、编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过B、编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,会看到输出文字:“hello!”C、编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看不到任何输出的文字D、编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息
考题
在J2EE中,Servlet1的代码如下: import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class Servlet1 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String aa=request.getQueryString(); String bb=request.getMethod(); out.println(aa); out.println(bb); } } 把Servlet1.class文件放在Web服务器适合的目录下,在浏览B器地址栏内输入:http://localhost:8080/servlet/Servlet1?name=jb-aptechphone=12345678,看到的结果是()。 A、name=jb-aptechphone=12345678 GETB、name=jb-aptech,phone=12345678 GETC、jb-aptech,12345678 POSTD、name,phone GETE、2,POST
考题
interface Data { public void load(); } abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?() A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }
考题
在J2EE中,有如下代码在Servlet1.java中 Import javax.servlet.*; Import javax,servlet.http.*; Import java.io,IOException; Import java.io.PrintWriter; Public class Servlet1 extends HttpServlet{ Public void init() throws ServletException{} Public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ PrintWriter out = reponse.getWriter(); Out.println("hello!"); } } 假如要编 译的环境已都已经搭建好。现在用完全正确的命令编译该文件,对于以下陈述正确的是(); A、编译文件时会提醒缺少doGet和doPost方法,编译不能成功通过B、编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会看到输出文字:“hello”C、编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet却看不到任何文字D、编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会却看到运行时的错误信息
考题
//point X public class foo { public static void main (String[]args) throws Exception { java.io.printWriter out = new java.io.PrintWriter { new java.io.outputStreamWriter (System.out), true; out.printIn(“Hello”); } } } Which statement at PointX on line 1 allows this code to compile and run?() A、 Import java.io.*;B、 Include java.io.*;C、 Import java.io.PrintWriter;D、 Include java.io.PrintWriter;E、 No statement is needed.
考题
//point X public class foo ( public static void main (Stringargs) throws Exception { printWriter out = new PrintWriter (new ) java.io.outputStreamWriter (System.out), true; out.printIn(“Hello”); } ) Which statement at PointX on line 1 allows this code to compile and run?()A、 Import java.io.PrintWriter;B、 Include java.io.PrintWriter;C、 Import java.io.OutputStreamWriter;D、 Include java.io.OutputStreamWriter;E、 No statement is needed.
考题
public class TestA{ public void methodA() throws IOException{ //…… } } public class TestB extends TestA{ public void methodA() throws EOFException{ //…… } } public class TestC extends TestA{ public void methodA() throws Exception{ //…… } } 当编译类TestC的时候,结果是哪项?() A、 正常B、 编译错误C、 运行错误D、 以上都不对
考题
单选题在J2EE中,Servlet1的代码如下: import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class Servlet1 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String aa=request.getQueryString(); String bb=request.getMethod(); out.println(aa); out.println(bb); } } 把Servlet1.class文件放在Web服务器适合的目录下,在浏览B器地址栏内输入:http://localhost:8080/servlet/Servlet1?name=jb-aptechphone=12345678,看到的结果是()。A
name=jb-aptechphone=12345678 GETB
name=jb-aptech,phone=12345678 GETC
jb-aptech,12345678 POSTD
name,phone GETE
2,POST
考题
单选题public class TestA{ public void methodA() throws IOException{ //…… } } public class TestB extends TestA{ public void methodA() throws EOFException{ //…… } } public class TestC extends TestA{ public void methodA() throws Exception{ //…… } } 当编译类TestC的时候,结果是哪项?()A
正常B
编译错误C
运行错误D
以上都不对
考题
单选题//point X public class foo { public static void main (Stringargs) throws Exception { java.io.printWriter out = new java.io.PrintWriter { new java.io.outputStreamWriter (System.out), true; out.printIn(“Hello”); } } } Which statement at PointX on line 1 allows this code to compile and run?()A
Import java.io.*;B
Include java.io.*;C
Import java.io.PrintWriter;D
Include java.io.PrintWriter;E
No statement is needed.
考题
单选题在j2ee中,有如下代码在servlet1.java中 Important javax.servelt.*; Important javax.servlet.http.* Import java.io.ioexception Import java.io.printwriter Public class servlet1 extends httpservlet{ Public void init() throws serveltexception{ } Public void service(httpservelt request request,httpserbletresponse response)throws servletexception,ioexception{ Printwriter out=response.getwriter(); Out.println(“hello”); } } 假如编译serblet 要具备的环境都已经建立好,现在用完全正确的命令编译该文件,对于以下陈述正确的是()A
编译该文件时会提示缺少doget()或者dopost()方法,编译不能够成功通过B
编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,会看到输出文字:“hello”C
编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,却看不到任何输出的文字D
编译后,把servlet1.class放在正确位置,在浏览器中查看该servlet1,却看到产生运行时错误的出差信息
考题
单选题在J2EE中,有如下代码在Servlet1.java中。 import javax.servlet.*; import javax.servlet.http.*; import java.io.IOException; import java.io.PrintWriter; public class Servlet1 extends HttpServlet { public void init() throws ServletException { } public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("hello!"); } } 假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下陈述正确的是()。A
编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过B
编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,会看到输出文字:“hello!”C
编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看不到任何输出的文字D
编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息
考题
单选题在J2EE中,有如下代码在Servlet1.Java中 Import javax.servlet.*; Import javax.servlet.http.* Import java.io.IOException; Import java.io.PrintWriter; Public class Servlet1 extends HttpServlet{ Public void init () throw ServletException {} Public void service(HttpServletRequest request, HttpServletResponce response) throws ServletException,IOException{ PrintWriter out=response.getWriter(); Out.println(“hello!”); } } 假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下成熟正确的是()A
编译该晚间时会提示缺少doGe()t或者doPost(),编译不能够成功通过B
编译后,把Serlvet.cass放在正确的位置,在浏览器中查看该Servlet1,会看到输出文在:“hello!”C
编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看不到任何输出的文字D
编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息
考题
单选题在J2EE中,有如下代码在Servlet1.java中 Import javax.servlet.*; Import javax,servlet.http.*; Import java.io,IOException; Import java.io.PrintWriter; Public class Servlet1 extends HttpServlet{ Public void init() throws ServletException{} Public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ PrintWriter out = reponse.getWriter(); Out.println("hello!"); } } 假如要编 译的环境已都已经搭建好。现在用完全正确的命令编译该文件,对于以下陈述正确的是();A
编译文件时会提醒缺少doGet和doPost方法,编译不能成功通过B
编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会看到输出文字:“hello”C
编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet却看不到任何文字D
编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会却看到运行时的错误信息
考题
单选题interface Data { public void load(); } abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?()A
public class Employee extends Info implements Data { public void load() { /*do something*/ } }B
public class Employee implements Info extends Data { public void load() { /*do something*/ } }C
public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D
public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E
public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F
public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }
热门标签
最新试卷