import java.applet.*;
import java.awt.*;
public class HelloWorld ( 15 ) {
public void paint(Graphics g){
g.drawString( " Hello World! " ,25,25);
}
}
[试题]下列程序构造了一个 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(){C.ontainer contentPane = getContentPane();contentPane.add(1);
[试题]( 8 )在下列 Java applet 程序的横线处填入代码,使程序完整并能够正确运行。Import java. awt. *;Import java. applet. *;Public class Greeting extends applet{Public void ( 8 ) (Graphics g) {g.drawSting( “ how are you! ” ,10,10);}}
[主观题]在下面Java Applet程序的下画线处填入代码,使程序完整并能够正确运行。import java.applet.*;import java.awt.*;public class HelloWorld ______ {public void paint(Graphics g) {g.drawString("Hello World!",25,25);}}
[试题]( 11 )在下列程序的下划线处,填入适当语句使程序能正确执行并输出异常栈信息。public class ThrowableException{public static void main(String args[]){try{throw new Throwable(" 这里是本人定义的异常 ");}catch(Throwable e){System.out.println("Caught Throwable");System.out.println("e.getMessage():
[试题]请在下划线处填入代码,是程序正常运行并且输出 “ Hello! ”C.lass Test ( 15 ) {Public static void main (String[] arge){Test t = new Test();t.start();}Public void run(){System.out.println( “ Hello! ” );}
[单选题]下列代码的下划线处应填入的方法名是______。import java.awt.*;import java.applet.*;public class Hello extends Applet{public void______(Graphics g){g.drawString("How are you!", 10, 10);}}A.) repaintB.) printlnC.) paintD.) showA.B.C.D.
[单选题]为使下列代码正常运行,应该在下划线处填入的选项是ObjectInputStream in=new_____(new FileInputStream(“employee . dat”));E.mployee[]newStaff=(Employee[〕)in.readObject();in .cIose();A.ReaderB.InputStreamC.ObjectInputD.ObjectInputStream
[单选题]为使下列代码正常运行,应该在下划线处填入的选项是abstract class Person{public Person(String n)!name=n;}public____String getDescription();public String getName(){return name;}private String name;}A.staticB.privateC.abstractD.final
[单选题]为使下列代码正常运行,应该在下划线处填入的选项是int〔〕numbers=new int[n];for(Int i=0;i <numbers.____;i++)numbers[i]=i+1;A.sizeB.lengthC.dimensionD.measurement
[单选题]为使下列代码正常运行,应该在下划线处填入的选项是int〔〕numbers=new int[n];for(Int i=0;i <numbers.____;i++)numbers[i]=i+1;A.sizeB.lengthC.dimensionD.measurement