one
one three two
one two three
one two three four
four one three two
编译失败
第1题:
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()
第2题:
将下面Applet程序补充完整。
import java.awt.*:
import java.apptet.*;
public class Hi ______ {
public void paint(Graghics g) {
g.drawstring("Hi!",2.5,2.5);
}
}
第3题:
A、%@import=”java.util.*”%
B、%@import=”java.util.*”@%
C、%@pageimport=”java.util.*”%
D、%@pagejava=”java.util.*”%
第4题:
从对象流中读取对象,请在下面横线处填写代码完成此程序。
import java.util. *;
import java. io. *;
public class UnSerializeDate
{
date d = null;
UnSerializeDate ( )
{
try
{
FileInputStream f1 = new FileInputStream("date.ser");
d = (Date) s. readobject ();
f1,close();
}
catch (Exceptin e)
{
e. printStackTrace ();
}
}
public static main(String args [] )
{
System.out.println("The date read is: "+ a.d.toString());
}
}
第5题:
请将下面的Applet程序补充完整。
import java. awt. *;
import java. applet. *;
public class Hi【 】{
public void paint(Graphics g){
g. drawString("Hi!", 25, 25);
}
}
第6题:
下列Java源程序结构中前三种语句的次序,正确的是
A.import, package, public class
B.import必为首,其他不限
C.public class, import, package
D.package, import, public class
第7题:
下列哪个选项的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{ }
第8题:
设有如下程序: import java.util.*; public class Sun { public static void main(String args[ ]) { int score; String a; Random r=new Random(); score=r.nextInt(4)+5; switch(score) { case 0: a="E"; break; case 1: a="D"; break; case 2: a="C"; break; case 3: a="B"; break; default: a="A"; } System.out.println(A) ; } } 程序运行的结果是( )。
A.a="A"
B.aa"E" a="A"
C.a="E"
D.a="C"
第9题:
下列代码的输出结果是( )。
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;
第10题:
下列哪个选项的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 { }