在Servlet中,下列语句可以正确获取PrintWriter对象的是() A、PrintWriter out = request.getWriter();B、PrintWriter out = request.getPrinteWriter();C、PrintWriter out = response.getWriter();D、PrintWriter out = responce.getPrinteWriter();
在Servlet中,下列语句可以正确获取PrintWriter对象的是()
- A、PrintWriter out = request.getWriter();
- B、PrintWriter out = request.getPrinteWriter();
- C、PrintWriter out = response.getWriter();
- D、PrintWriter out = responce.getPrinteWriter();
相关考题:
在Servlet中,下列语句可以正确获取PrintWriter对象的是() A.PrintWriterout=request.getWriter();B.PrintWriterout=request.getPrinteWriter();C.PrintWriterout=response.getWriter();D.PrintWriterout=responce.getPrinteWriter();
给定以下程序段//insertcodepublicclassfoo(publicstaticvoidmain(String[]args)throwsExceptionprintWriterout=newPrintWriter(new java.io.outputStreamWriter(System.out),true);out.printIn(“Hello”);要使程序能正确运行,在//insertcode处必须添加()语句。A.importjava.io.PrintWriter;B.includejava.io.PrintWriter;C.importjava.io.OutputStreamWriter;D.includejava.io.OutputStreamWriter;
importjava.io.PrintWriter;classDoFormat{publicstaticvoidmain(String[]args){intx=42;inty=12345;floatz=7;System.out.format(-%4d-,x);System.out.format(-%4d-,y);System.out.format(-%4.1d-,z);}}结果为:()A.编译失败B.-42--1234--7.0-C.-42--1234--7.0-D.运行时异常被抛出
现有importjava.io.PrintWriter;classDoFormat{publicstaticvoidmain(String[]args){intx=42;inty=12345;floatZ-7;System.out.format(一%4d-,X);System.out.format(-%4d-,y);System.out.format(-%4.ld-,z);}}结果为:()A.编译失败B.-42--1234--7.0-C.-42--1234--7.0-D.-42--12345--7.0-E.运行时异常被抛出
//pointXpublicclassfoo{publicstaticvoidmain(String[]args)throwsException{java.io.printWriterout=newjava.io.PrintWriter{newjava.io.outputStreamWriter(System.out),true;out.printIn(Hello”);}}}WhichstatementatPointXonline1allowsthiscodetocompileandrun?()A.Importjava.io.*;B.Includejava.io.*;C.Importjava.io.PrintWriter;D.Includejava.io.PrintWriter;E.Nostatementisneeded.
//pointXpublicclassfoo(publicstaticvoidmain(String[]args)throwsException{printWriterout=newPrintWriter(newjava.io.outputStreamWriter(System.out),true;out.printIn(Hello”);})WhichstatementatPointXonline1allowsthiscodetocompileandrun?()A.Importjava.io.PrintWriter;B.Includejava.io.PrintWriter;C.Importjava.io.OutputStreamWriter;D.Includejava.io.OutputStreamWriter;E.Nostatementisneeded.
在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文件的main函数只包含如下代码: try { PrintWriter out = new PrintWriter(new FileOutputStream(“employee.txt”)); String name = “jb-aptech”; double salary = 75000; out.print(name); out.print(„ „); out.println(salary); } catch(Exception e) System.out.println("文件没有发现!"); 在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。 A、使用java命令运行该类文件,将在控制台上打印:"文件没有发现!"B、运行结束后打开employee.txt,会发现该文件什么也没有C、运行结束后打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000”D、在第7行后加上代码:out.close(),编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech 75000.0”E、把第2行代码改为: PrintWriter out = new PrintWriter(new FileOutputStream(“employee.txt”),true); 编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech 75000.0”
在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,却看到产生运行时错误的出错信息
在servlet中,下列语句可以正确获取PrintWriter对象的是() A、PrintWriter out=request.getWriter();B、PrintWriter out=request.getPrintWriter();C、PrintWriter out=respinse.getWriter()D、PrintWriter out=respinse.getPrintWriter()
在J2EE中,利用下列构造函数准备对文件abc.txt操作,但文件abc.txt在当前目录不存在,不会产生运行时错误的是()。 A、BufferedReader breader=new BufferedReader(new FileReader("abc.txt"));B、PrintWriter out = new PrintWriter(new FileWriter(“abc.txt”),true);C、FileInputStream fin = new FileInputStream(“abc.txt”);D、OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(“abc.txt”));
在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
现有:D - f 是一个对 java.io.File 实例的合法引用 - fw 是一个对 java.io.FileWriter 实例的合法引用 - bw 是一个对 java.io.BufferedWriter 实例的合法引用 以下哪一项无效?() A、 PrintWriter prtWtr = new PrintWriter(f);B、 PrintWriter prtWtr = new PrintWriter(fw);C、 PrintWriter prtWtr = new PrintWriter(bw);D、 BufferWriter bufWtr = new BufferedWriter(f);E、 BufferWriter bufWtr = new BufferedWriter(fw);F、 BufferWriter bufWtr = new BufferedWriter(bw);
在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文 件的main函数只包含如下代码: try{ //1 PrintWriter out =new PrintWriter(new FileOutputStream(“employee.txt”)); //2 String name = “jb-aptech”; //3 double salary = 75000; //4 out.print(name); //5 out.print(“ ”); //6 out.println(salary); //7 } //8 catch(Exception e) { //9 System.out.println(“文件没有发现!”); //10 } //11 在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。 A、使用java命令运行该类文件,将在控制台上打印:”文件没有发现!”B、运行结束后打开employee.txt,会发现该类文件什么也没有C、运行结束打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000”D、在第7行后加上:out.close(),编译并运行该文件后,打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000.0”E、把第2行代码改为:PrintWriter out = PrintWriter(new File
现有: - f 是一个对 java.io.File 实例的合法引用 - fw 是一个对 java.io.FileWriter 实例的合法引用 - bw 是一个对 java.io.BufferedWriter 实例的合法引用 以下哪一项无效?() A、 PrintWriter prtWtr = new PrintWriter(f);B、 PrintWriter prtWtr = new PrintWriter(fw);C、 PrintWriter prtWtr = new PrintWriter(bw);D、 BufferWriter bufWtr = new BufferedWriter(f);E、 BufferWriter bufWtr = new BufferedWriter(fw);F、 BufferWriter bufWtr = new BufferedWriter(bw);
//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.
现有: String s="write a line to a file"; w.print(s+"/n"); 哪一个是对的?() A、w即可以是PrintWriter类型,也可以足BufferedWriter类型。B、w即不可以是PrintWriter类型,也不可以足BufferedWriter类型。C、w可以是BufferedWriter类型,但不可以是PrintWriter类型。D、 w以是PrintWriter类型,但不可以是BufferedWriter类型。
//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.
现有: -f是一个对java .io.File实例的合法引用 - fw足‘个对java.io.FileWriter实例的合法引用 - bw足一个对java.io.BufferedWriter实例的合法引用 以下哪一项无效?() A、PrintWriter prtWtr = new PrintWriter (f);B、PrintWriter prtWtr = new PrintWriter( fw);C、PrintWriter prtWtr = new PrintWriter(bw):D、BufferWriter bufWtr = new BufferedWritr(f);E、BufferWriter bufWtr = new BufferedWriter(fw);F、BufferWriter bufWtr = new BufferedWriter (bw):
多选题在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文件的main函数只包含如下代码: try { PrintWriter out = new PrintWriter(new FileOutputStream(“employee.txt”)); String name = “jb-aptech”; double salary = 75000; out.print(name); out.print(„ „); out.println(salary); } catch(Exception e) System.out.println("文件没有发现!"); 在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。A使用java命令运行该类文件,将在控制台上打印:文件没有发现!B运行结束后打开employee.txt,会发现该文件什么也没有C运行结束后打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000”D在第7行后加上代码:out.close(),编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech 75000.0”E把第2行代码改为: PrintWriter out = new PrintWriter(new FileOutputStream(“employee.txt”),true); 编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech 75000.0”
单选题在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,看到的结果是()。Aname=jb-aptechphone=12345678 GETBname=jb-aptech,phone=12345678 GETCjb-aptech,12345678 POSTDname,phone GETE2,POST
单选题现有:D - f 是一个对 java.io.File 实例的合法引用 - fw 是一个对 java.io.FileWriter 实例的合法引用 - bw 是一个对 java.io.BufferedWriter 实例的合法引用 以下哪一项无效?()A PrintWriter prtWtr = new PrintWriter(f);B PrintWriter prtWtr = new PrintWriter(fw);C PrintWriter prtWtr = new PrintWriter(bw);D BufferWriter bufWtr = new BufferedWriter(f);E BufferWriter bufWtr = new BufferedWriter(fw);F BufferWriter bufWtr = new BufferedWriter(bw);
单选题现有: String s="write a line to a file"; w.print(s+"/n"); 哪一个是对的?()Aw即可以是PrintWriter类型,也可以足BufferedWriter类型。Bw即不可以是PrintWriter类型,也不可以足BufferedWriter类型。Cw可以是BufferedWriter类型,但不可以是PrintWriter类型。D w以是PrintWriter类型,但不可以是BufferedWriter类型。
多选题在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文 件的main函数只包含如下代码: try{ //1 PrintWriter out =new PrintWriter(new FileOutputStream(“employee.txt”)); //2 String name = “jb-aptech”; //3 double salary = 75000; //4 out.print(name); //5 out.print(“ ”); //6 out.println(salary); //7 } //8 catch(Exception e) { //9 System.out.println(“文件没有发现!”); //10 } //11 在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。A使用java命令运行该类文件,将在控制台上打印:”文件没有发现!”B运行结束后打开employee.txt,会发现该类文件什么也没有C运行结束打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000”D在第7行后加上:out.close(),编译并运行该文件后,打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000.0”E把第2行代码改为:PrintWriter out = PrintWriter(new File
单选题在Servlet中,下列语句可以正确获取PrintWriter对象的是()APrintWriter out = request.getWriter();BPrintWriter out = request.getPrinteWriter();CPrintWriter out = response.getWriter();DPrintWriter out = responce.getPrinteWriter();
单选题在servlet中,下列语句可以正确获取PrintWriter对象的是()APrintWriter out=request.getWriter();BPrintWriter out=request.getPrintWriter();CPrintWriter out=respinse.getWriter()DPrintWriter out=respinse.getPrintWriter()
单选题//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.