考题
2下列程序实现对ZIP 文件file.zip 的检索,在横线处填入正确的语句是( )。package test;import java.io.*;import java.util.*; import java.util.zip.*;public class Exam{ public static void main(String[] args){ try{ FileInputStream fis = new FilelnputStream("test/file.zip"); ZipInputStream zis = new ZiplnputStream(fis); ZipEntry en; while ((______ )!= null){ en.getName(); zis.closeEntry(); } zis.close(); } catch(Exception e){ e.pfintStackTrace(); }}A.en = zis. getNextEntry()B.en == zis.getNextEntry(C.en=zis. getEntry()D.zis.getNextEntry()
考题
在编写Java Applet程序时,若需要对发生的事件做出响应和处理,一般需要在程序的开头写上( )语句。A.import java.awt.*;B.import java.applet.*;C.import java.io.*;D.import java.awt.evcnt.*;
考题
( 16 )阅读下面程序import java.io.*;public class TypeTransition{public static void main(String args[]){char a = 'h';int i = 100;int j = 97;int aa = a + i;System.out.println("aa="+aa);char bb = (char)j;System.out.println("bb="+bb);}}如果输出结果的第二行为 bb=a ,那么第一行的输出是A ) aa=IB ) aa=204C ) aa=vD ) aa=156
考题
下面程序运行时输出的结果为C:\Program Files is a directory.将程序补充完整。Import java.io.*;public class DirTest {public static void main(String[] args) {File myDir=Flew File("C:/Program Files/");System.out.println(myDir+(______.isDirectory()?"is":"is not")+"a directory.");}}
考题
( 16 )请阅读下面程序import java.io.*;public class TypeTransition {public static void main ( String args[] ){char a = 'a' ;int i = 100 ;long y = 456L ;int aa = a + i ;long yy = y-aa ;System.out.print ( "aa = "+aa ) ;System.out.print ( "yy = ” +yy ) ;}}程序运行结果是A ) as = 197 yy = 259B ) as=77 yy = 259C ) as = 543 yy = 288D ) as = 197 yy = 333
考题
在Java Applet程序中,如果对发生的事件做出响应和处理的时候,应该使用下列哪个语句A.import java.awt.event.*;B.import java.io.*;C.import java.awt.*;D.import java.applet.*;
考题
请阅读下面程序 import java.io. *; public class TypeTransition { public static void main(String args[]){ char a='a'; int i=l00; long y=456L; int aa=a+i; long yy=y-aa; System.out.print("aa = "+aA.aa=197 yy=259B.aa=177 yy=259C.aa=543 yy=288D.aa=197 yy=333
考题
请完成下列Java程序:实现打印出自己的源文件的功能。注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。import java.io.*;import java.util.StringTokenizer;public class ex27_2{public static void main(String args[])throws IOException{FileInputStream fis=new FileInputStream("ex27_2.java");DataInputStream dis=new DataInputStream(fis);String str=null;while(true){__________________;if(str==null){__________________;}StringTokenizer st=new StringTokenizer(str);while(st.hasMoreTokens()){System.out.print(st.nextToken()+ " " );}System.out.println();}}}
考题
下列哪个选项的java源文件代码片段是不正确的?A.package testpackage; public class Test{ }B.import java. io. *; package testpaekage; public class Test { }C.import java.io.*; class Person { } public class Test { }D.import java.io.*; import java. awt.*; public class Test{ }
考题
在Java职Applet程序中,对发生的事件做出响应和处理的时候,应该使用( )。A.import java.awt.event.*;B.import java.io.*;C.import java.awt.*;D.import java.applet.*;
考题
下列( )选项的java源文件代码片段是不正确的。A.package testpackage; publicClass Test{}B.import java.io.*; package testpackage: publicClass Test{}C.import java.io.*; Class Person{} publicClass Test{}D.import java.io.*; import java.awt.*; publicClass Test{}
考题
在编写JavaApplet程序时,若需要对发生的事件作出响应和处理,一般需要在程序的开头写上( )语句。A.import java.awt.*;B.import java.applet.*C.import java.io.*;D.import java.awt.event.*;
考题
下列代码的输出结果是( )。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;
考题
定义JavaApplet程序时,必须有的imPort语句是( )。A.import java.applet. Applet;B.import java.io.*;C.import java.awt.event;D.import java.lang, *;
考题
在编写Java Applet程序时,若需要对发生的事件做出响应和处理,一般需要在程序的开头写上______语句。A.import java.io.*;B.importjava.applet.*;C.importjava.awt.*;D.importjava.awt.event.*;
考题
下列哪个选项的java源文件程序段是不正确的? ( )A.package testpackage; public class Test{ }B.import java.io.*; package testpackage; public class Test{ }C.import java.i.*; class Person{} public class Test{ }D.import java.io.*; import java.awt.*; public class Test { }
考题
下列程序实现对ZIP文件file.zip的检索,在横线处填入正确的语句 package test; import java.io.*: import java.util.*; import java.util.zip.*; public class Exam { public static void main(String[])args){ try{ FileInputStream fis=new FileInputStream("test/file.zip"); ZipInputStreamzis=new ZipInputStream(fis); ZipEntry en; while ((_____)!=null){ en.getName(); zis.closeEntry(); } zis.close(); } catch(Exception e) { e.printStackTrace(); } } }A.en = zis.getNextEntry()B.en = zis.getNextEntry()C.en = zis.getEntry()D.zis.getNextEntry()
考题
在单一文件中import、class和package的正确出现顺序是()A、package,import,classB、class,import,packageC、import,package,classD、package,class,import
考题
在编写Java Applet程序时,若需要对发生的事件作出响应和处理,一般需要在程序的开头写上( )语句。 ;A、import java.awt.* ;B、import java.applet.* ;C、import java.io.* ;D、import java.awt.event.*
考题
与page指令%@ page import= “java.util.*, java.text.* “ % 等价的是()。A、%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ page import= “java.util.* % %@ page import= “java.text.* “ % B、%@ page import= “java.util.*” , import= “java.text.* “ % C、%@ page import= “java.util.* “ ; % %@ page import= “java.text.* “ ; %D、%@ page import= “java.util.* ; java.text.* “ %
考题
//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.
考题
Given a class Repetition: 1.package utils; 2. 3.public class Repetition{ 4.public static String twice(Strings){returns+s;} 5.} and given another class Demo: 1.//insert code here2. 3.public class Demo{ 4.public static void main(String[]args){ 5.System.out.println(twice("pizza")); 6.} 7.} Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()A、import utils.*;B、static import utils.*;C、importutils.Repetition.*;D、static importutils.Repetition.*;E、import utils.Repetition.twice();F、import static utils.Repetition.twice;G、static import utils.Repetition.twice;
考题
// Point X public class foo { public static void main(String[] args) throws Exception { jave.io.PrintWriter out = new jave.io.PrintWriter( new jave.io.OutputStreamWriter(System.out), true); out.println(“Hello”); } } Which statement at Point X on line 1 is required to allow this code to compile?() A、 No statement is required.B、 import jave.io.*;C、 include java.io.*;D、 import jave.io.PrintWriter;E、 include java.io.PrintWriter;
考题
单选题// Point X public class foo { public static void main(String[] args) throws Exception { jave.io.PrintWriter out = new jave.io.PrintWriter( new jave.io.OutputStreamWriter(System.out), true); out.println(“Hello”); } } Which statement at Point X on line 1 is required to allow this code to compile?()A
No statement is required.B
import jave.io.*;C
include java.io.*;D
import jave.io.PrintWriter;E
include java.io.PrintWriter;
考题
单选题与page指令 等价的是()。A
%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ page import= “java.util.* % %@ page import= “java.text.* “ % B
%@ page import= “java.util.*” , import= “java.text.* “ % C
%@ page import= “java.util.* “ ; % %@ page import= “java.text.* “ ; %D
%@ page import= “java.util.* ; java.text.* “ %
考题
单选题//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.
考题
单选题在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
考题
单选题Given a class Repetition: 1. package utils; 2. 3. public class Repetition { 4. public static String twice(String s) { return s + s; } 5. } and given another class Demo: 1. // insert code here 2. 3. public class Demo { 4. public static void main(String[] args) { 5. System.out.println(twice(”pizza”)); 6. } 7. } Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()A
import utils.*;B
static import utils.*;C
import utils.Repetition.*;D
static import utils.Repetition. *;E
import utils.Repetition.twice();F
import static utils.Repetition.twice;G
static import utils.Repetition.twice;