网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

importjava.awt.*;publicclassTestextendsFrame{publicTest(){add(newLabel(Hello”));add(newTextField(Hello”));add(newButton(Hello”));pack();show();}publicstaticvoidmain(Stringargs){newTest();}}Whatistheresult?()

A.Thecodewillnotcompile.

B.AWindowwillappearcontainingonlyaButton.

C.AnIllegalArgumentExceptionisthrownatline6.

D.AWindowbuttonwillappearbutwillnotcontaintheLabel,TextField,orButton.

E.AWindowwillappearcontainingaLabelatthetop,aTextFieldbelowtheLabel,andaButtonbelowtheTextField.

F.AWindowwillappearcontainingaLabelontheleft,aTextFieldtotherightoftheLabel,andabuttontotherightoftheTextField.


参考答案

更多 “ importjava.awt.*;publicclassTestextendsFrame{publicTest(){add(newLabel(Hello”));add(newTextField(Hello”));add(newButton(Hello”));pack();show();}publicstaticvoidmain(Stringargs){newTest();}}Whatistheresult?()A.Thecodewillnotcompile.B.AWindowwillappearcontainingonlyaButton.C.AnIllegalArgumentExceptionisthrownatline6.D.AWindowbuttonwillappearbutwillnotcontaintheLabel,TextField,orButton.E.AWindowwillappearcontainingaLabelatthetop,aTextFieldbelowtheLabel,andaButtonbelowtheTextField.F.AWindowwillappearcontainingaLabelontheleft,aTextFieldtotherightoftheLabel,andabuttontotherightoftheTextField. ” 相关考题
考题 下列程序的作用是在屏幕上显示一个200×200大小的窗口,在横线上填入相应的语句。import java.awt.*;public class Test extends Frame. {public static void main (String args[]) {Test t=new Test ("Hello");t.setSize (200,200);t.setBackground (Color.re@D)@;【 】;}public Test (String str) {super(str);}}

考题 下列Application程序中,指定as为字符串数组类型,先创建一个HashSet对象并赋值,然后在屏幕输出s,请将程序补充完整。import java.util.*;public class test17_1{public static void main(String[] args){__________s=new HashSet();s.add("Hello");s.add("World");s.add(new Character('我'));s.add(new Integer(23));s.add("Hello");__________as={"W","o","r","1","d"};s.add(as);s.add(null);s.add(new Integer(23));s.add(null);System.out.println(__________);

考题 Giventhefollowingcode,whichcodefragments,wheninsertedattheindicatedlocation,willsucceedinmakingtheprogramdisplayabuttonspanningthewholewindowarea?()importjava.awt.*;publicclassQ1e65{publicstaticvoidmain(Stringargs[]){Windowwin=newFrame();Buttonbut=newButton(button);//insertcodefragmentherewin.setSize(200,200);win.setVisible(true);}}A.win.setLayout(newBorderLayout());win.add(but);B.win.setLayout(newGridLayout(1,1));win.add(but);C.win.setLayout(newBorderLayout());win.add(but,BorderLayout.CENTER);D.win.add(but);E.win.setLayout(newFlowLayout());win.add(but);

考题 下列A1pplet实现在键盘上输入一个字符串,然后将该字符串照原样显示在屏幕上。请选择正确的语句填入横线处。 import java.awt.*; import java.applet.*; public class ex28 extends Applet { Label 11, 12; TextField tf; public void init() { setLayout (new GridLayout(3, 1); 11 = new Label("请输入一个字符串:"); 12 = new Label("");. tf = new TextField(15); add(11); add(tf); add(12); setSize(150, 100); } public boolean action(Event e, Object o) { if(e.target == tf) repaint (); return true; } }A.12.setText(11.getText());B.11.setText(12.getText());C.11.setText(tf, getText());D.12.setText(tf.getText());

考题 阅读下面Applet程序 import javax. swing. *; import java. awt. *; public class SwintgApplet extends JApplet{ JLabel 1=new JLabel("This is a Swing Applet."); public void init(){ ________________________________ } } 在程序下画线处填入正确的选项是A.Container contentPane=getContenPane(); cotentPane. add(1);B.JPanel comtenPane=new Jpane(); contentPane. add(1);C.contentPane. add(1);D.add(1);

考题 请将下列程序的空白处补充完整。Importjava.awt.*;PublicclassEll_4{Publicstaticvoidmain(Stringargs[]){Framef=newFrame(“BorderLayout”);fiadd(“North”,newbuRon(“North”));f.add(“East”,newbutton(“East”));f.add(“West”,newbutton(“West”));f.add(“South”,tf);f.setSize(200,200)fipack();fisetVisible(true);}}

考题 阅读下面Applet程序 import javax.swing.*: import java.awt.*: public Class Test SwingApplet extends JApplet { JLabel 1=new JLabel("This is a Swing Applet."); public void init() { ______ } } 程序中下画线处应填入的正确选项是A.Container contentPane=getContentPane();contentPane.add(1);B.Jpanel contentPane=new JPanel();contentPane.add(1);C.contentPane.add(1);D.add(1);

考题 下列JApplet实现了一个可编辑的JTextArea和一个JButton,横线上应填入的语句是( )。 import javax.swing.*; import java.awt.*; public class Test extends JApplet { JTextArea jta; public void init () { Container cp=getContentPane(); cP.setLayout (new GridLayout (2,1)); jta=newJTextArea (30,30); jta.setEditable (true); __________ jta.setText("你好"); JBulton jb=new JButton("OK"); cp.add(jb); } }A.add(jta);B.cp.add( );C.jts.add(cp);D.cp.add(jta);

考题 分析如下Java代码,编译运行后将输出( )。publicclassTest{publicTest(){}staticvoidprint(ArrayListal){al.add(2);al=newArrayList();al.add(3);al.add(4);}publicstaticvoidmain(String[]args){Testtest=newTest();ArrayListal=newArrayList();al.add(1);print(al);System.out.println(al.get(1));}}A、1B、2C、3D、4