多选题import java.awt*;   public class X extends Frame (   public static void main(string args) (  X x = new X ();   X.pack();   x.setVisible(true);  )  public X () (   setlayout (new GridLayout (2,2));   Panel p1 = new panel();    Add(p1);    Button b1= new Button (“One”);    P1.add(b1);   Panel p2 = new panel();    Add(p2);   Button b2= new Button (“Two”);    P2.add(b2);    Button b3= new Button (“Three”);   add(b3);   Button b4= new Button (“Four”);   add(b4);   )   )   Which two statements are true? ()AAll the buttons change height if the frame height is resized.BAll the buttons change width if the Frame width is resized.CThe size of the button labeled “One” is constant even if the Frame is resized.DBoth width and height of the button labeled “Three” might change if the Frame is resized.

多选题
import java.awt*;   public class X extends Frame (   public static void main(string args) (  X x = new X ();   X.pack();   x.setVisible(true);  )  public X () (   setlayout (new GridLayout (2,2));   Panel p1 = new panel();    Add(p1);    Button b1= new Button (“One”);    P1.add(b1);   Panel p2 = new panel();    Add(p2);   Button b2= new Button (“Two”);    P2.add(b2);    Button b3= new Button (“Three”);   add(b3);   Button b4= new Button (“Four”);   add(b4);   )   )   Which two statements are true? ()
A

All the buttons change height if the frame height is resized.

B

All the buttons change width if the Frame width is resized.

C

The size of the button labeled “One” is constant even if the Frame is resized.

D

Both width and height of the button labeled “Three” might change if the Frame is resized.


参考解析

解析: 暂无解析

相关考题:

在如下源代码文件Test.java中, 哪个是正确的类定义?() A.public class test { public int x = 0; public test(int x) { this.x = x; } }B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }D.public class

下列类头定义中,错误的是( )。 A.class x { .... }B.public x extends y { .... }C.public class x extends y { .... }D.class x extends y implements y1 { .... }

Given:Which two, inserted at line 11, will allow the code to compile?() A.public class MinMax? {B.public class MinMax? extends Number {C.public class MinMaxN extends Object {D.public class MinMaxN extends Number {E.public class MinMax? extends Object {F.public class MinMaxN extends Integer {

请完善程序(程序文件名:Java_2.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。[题目要求]在JFrame窗口中,显示一个字符串并保证窗口正常关闭和退出,使程序运行结果如下图所示。源程序:import javax.swing.*:import java.awt.*;public class Java_2 {public static void main(String[] args) {WelcomFrame. frame=new WelcomFrame();frame.setDefaultCloseOperation(JFrame. (1) );frame.show();}}class WelcomFrame. extends (2) {public WelcomFrame() {setTitle("Java等级考试");(3) (DEFAULT_WIDTH,DEFAULT_HEIGHT);WelcomPanel panel=new WelcomPanel();Container contentPane=getContentPane();contentPane.add(panel);}public static final int DEFAULT_WIDTH=250;public static final int DEFAULT_HEIGHT=100;}class WelcomPanel extends (4) {public void paintComponent(Graphics g) {super.paintComponent(g);g.drawString("欢迎参加Java等级考试!",MESSAGE_X,MESSAGE_Y);}public static final int MESSAGE_X=60:public static final int MESSAGE_Y=50:}

在下列源代码文件Test.java中,正确定义类的代码是( )。A.pblic class test { public int x=0; public test(int x) { this. x=x;} }B.public class Test { public int x=0; public Test(int x) { this. x=x;} }C.public class Test extends T1,T2{ public int x = 0; public Test(int x){ this. x = x; } }D.protected class Test extends T2{ public int x = 0; public Test(int x) { this. x = x; } }

下面程序创建一个长宽均为100的Frame窗口,并且窗口的背景颜色是蓝色。请将程序补充完整。注意:不改动程序结构,不得增行或删行。import java.awt .*;public class ex1 extends Frame{public static void main(String[] args){ex1 t=new ex1();t.setSize(100,100);______t.setVisible(true);}}

选择正确的语句填在下列程序的横线处。 import java.awt.*; import java.awt.event.*; public class ex30 { Frame. f; public static void main(String[] args) { ex30 e = new ex30(); e. te st ( ); } public void test() { f = new Frame("ex30"); ______ f.paok(); f.setVisible(true); } class MyWindowListener extends WindowAdapter { public void windowClosing(WindowEvent e) { System.exit(1); } } }A.f.addWindowListener(new MyWindowtistener());B.f.addWindowListener(MyWindowListener());C.f.addWindowAdapter(new MyWindowListener());D.addWindowListener(new MyWindowListener());

请完善程序(程序文件名:Java_3.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。[题目要求]生成下面左边图形界面,单击图中的New按钮,弹出如右图所示的对话框。源程序:import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Java_3 {public static void main(String[] args) {MulticastFrame. frame=new MulticastFrame();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.show();}}class MulticastFrame. extends JFrame. {public MulticastFrame() {setTitle("MulticastTest");setSize(WIDTH,HEIGHT);MulticastPanel panel=new MulticastPanel();Container contentPane=getContentPane();contentPane.add( (1) );}public static final int WIDTH=300;public static final int HEIGHT=200;}class MulticastPanel extends JPanel }public MulticastPanel() {JButton newButton=new JButton("New");add(newButton);ActionListener newListener=new ActionListener() {public void actionPerformed(ActionEvent event) {makeNewFrame();}};newButton.addActionListener(newListener);closeAllButton=new JButton("Close all");add(closeAllButton);}private void makeNewFrame() {final BlankFrame. frame=new BlankFrame();frame.show();ActionListener closeAllListener=new ActionListener() {public void actionPerformed(ActionEvent event) {frame. (2) (); //使窗口隐藏或消除}};closeAllButton.addActionListener( (3) );}private JButton closeAllButton;}Class BlankFrame. extends JFrame. {public BlankFrame() {(4) ++;setTitle("Frame"+counter);setSize(WIDTH,HEIGHT);setLocation(SPACING*counter,SPACING*counter);}public static final int WIDTH=200;public static final int HEIGHT=150;public static final int SPACING=30;private static int counter=0;}

在下列源代码文件Test.java中, ( )是正确的类定义。A.public class test{B.public class Test{ public int x=0;public int x=0; public test (intx) public Test (int x){ {this.x=x; this.x=x;} }} }C.public class Test extends T1,T2{D.protected class Test extends T2{ public int=0;public int x=0; public Test(int x){Public Test (int x){ this.x=x;this.x=x: }} }}

本题的功能是获取鼠标在窗口中的位置。当鼠标移进窗口中,就会实时显示鼠标在窗口中的相对位置,比如显示为"鼠标的当前位置:X:Y"(其中,X为横坐标,Y为纵坐标)。import java.awt.*;import java.awt.event.*;import java.util.*;import javax.swing.*;public class java2{public static void main(String[]args){MouseFrame. frame=new MouseFrame();frame.setDefaultCloseoperation(JFrame.EXIT_0N CLOSE);frame.show();}}class MouseFrame. extends JFrame{public MouseFrame(){setTitle("java2");setSize(WIDTH,HEIGHT);MousePanel panel=new MousePanel();Container contentPane=getContentPane();contentPane.add(panel);}public static final int WIDTH = 300;public static final int HEIGHT=200;}class MousePanel extends JPanel{public MousePanel(){addMouseListener(new MouseHandler());addMouseMotionListener(new MouseMotionHan-dler());}public void paintComponent(Graphics g)(super.paintComponent(g);String text="鼠标指针位置:"+mousex+":"+mousey;g.drawString(text,10,10);}private int mousex,mousey;private class MouseMotionHandler {public void mouseMoved(MouseEvent event){mousex=event.getX();mousey=event.getY();repaint();}public void mouseDragged(MouseEvent event){mousex=event.getX();mousey=event.getY();repaint();}}private class MouseHandler{public void mousePressed(MouseEvent eveat){mousex=event.getX();mousey=event.getY();}}}

本题中,生成一个窗口,该窗口的长、宽为屏幕长、宽的一半,并且窗口的大小不能改变。import java.awt.*;import javax.swing.*;public class java2{public.static void main(String[]args){FrameSize frame=new FrameSize();frame.setDefaultCloseoperation(JFrame.EXITON_CLOSE);frame.show();}}class FrameSize extends JFrame{public FrameSize(){setTitle("java2");Toolkit tk=Toolkit.getDefaultToolkit();Dimension screenSize=int screenHeight=screenSize.height;int screenWidth=screenSize.width;setSize(screenWidth/2,sereenHeight/2);;}

在下列源代码文件Test.java中,哪个选项是正确的类定义? ( )A.public class test { public int x=0; public test(int x) { this.x=x; } }B.public class Test { public int x=0; public Test(int x) { this.x=x; } }C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }

请在下划线处填入代码,使程序能够正确运行。import java .awt.*;import java .applet.*;public class SayHi extends Applet{public void【 】(Graphics g){g .drawString(“Hi!”20,20);}}

In which two cases does the compiler supply a default constructor for class A?()  A、 class A{}B、 class A { public A(){} }C、 class A { public A(int x){} }D、 class Z {} class A extends Z { void A(){} }

Which three demonstrate an “is a” relationship?() A、 public class X { }  public class Y extends X { }B、 public interface Shape { }  public interface Rectangle extends Shape{ }C、 public interface Color { }  public class Shape { private Color color; }D、 public interface Species { }  public class Animal { private Species species; }E、 public class Person { } public class Employee {  public Employee(Person person) { }F、 interface Component { }  class Container implements Component { private Component[] children; }

interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?() A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

下列类的定义中,错误的是()。A、class x{....}B、public x extends y{....}C、public class x extends y{....}D、class x extends y implements y1{....}

public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()A、 public void aMethod() {}B、 private void aMethod() {}C、 public void aMethod(String s) {}D、 private Y aMethod() { return null; }E、 public X aMethod() { return new Y(); }

Which the two demonstrate an “is a” relationship?()A、 public interface Person {}  Public class Employee extends Person {}B、 public interface Shape {}  public interface Rectangle extends Shape {}C、 public interface Color {}  public class Shape { private Color color; }D、 public class Species {}  public class Animal { private Species species; }E、 interface Component {} Class Container implements Component {private Component [] children;

Which two demonstrate an “is a” relationship?()   A、 public interface Person { }  public class Employee extends Person { }B、 public interface Shape { }  public class Employee extends Shape { }C、 public interface Color { }  public class Employee extends Color { }D、 public class Species { }  public class Animal (private Species species;)E、 interface Component { }  Class Container implements Component ( Private Component[ ]children;  )

What produces a compiler error?()  A、 class A { public A(int x) {} }B、 class A {} class B extends A { B() {} }C、 class A { A() {} } class B { public B() {} }D、 class Z { public Z(int) {} } class A extends Z {}

public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()A、 public class Circle implements Shape { private int radius; }B、 public abstract class Circle extends Shape { private int radius; }C、 public class Circle extends Shape { private int radius; public void draw(); }D、 public abstract class Circle implements Shape { private int radius; public void draw(); }E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

单选题interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?()A public class Employee extends Info implements Data { public void load() { /*do something*/ } }B public class Employee implements Info extends Data { public void load() { /*do something*/ } }C public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

多选题Which three demonstrate an “is a” relationship?()Apublic class X { }  public class Y extends X { }Bpublic interface Shape { }  public interface Rectangle extends Shape{ }Cpublic interface Color { }  public class Shape { private Color color; }Dpublic interface Species { }  public class Animal { private Species species; }Epublic class Person { } public class Employee {  public Employee(Person person) { }Finterface Component { }  class Container implements Component { private Component[] children; }

多选题public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()Apublic class Circle implements Shape { private int radius; }Bpublic abstract class Circle extends Shape { private int radius; }Cpublic class Circle extends Shape { private int radius; public void draw(); }Dpublic abstract class Circle implements Shape { private int radius; public void draw(); }Epublic class Circle extends Shape { private int radius;public void draw() {/* code here */} }Fpublic abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

多选题Which two demonstrate an “is a” relationship?()Apublic interface Person { }  public class Employee extends Person { }Bpublic interface Shape { }  public class Employee extends Shape { }Cpublic interface Color { }  public class Employee extends Color { }Dpublic class Species { }  public class Animal (private Species species;)Einterface Component { }  Class Container implements Component ( Private Component[ ]children;  )

单选题What produces a compiler error?()A class A { public A(int x) {} }B class A {} class B extends A { B() {} }C class A { A() {} } class B { public B() {} }D class Z { public Z(int) {} } class A extends Z {}