static final int[] a = { 100,200 };
static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }
static final int[] a = new int[2]{ 100,200 };
static final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }
第1题:
请完善程序(程序文件名: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;
}
第2题:
public interface Foo{ int k = 4; } Which three are equivalent to line 2?()
第3题:
public interface Foo { int k = 4; 3. } Which three are equivalent to line 2?()
第4题:
MAX_LENGTH是int型public成员变量,变量值保持为常量100,其定义是()。
第5题:
MAX_LENGTH是int型public成员变量, 变量值保持为常量100,用简短语句定义这个变量。()
第6题:
Which two code fragments correctly create and initialize a static array of int elements()
第7题:
Given: 1. public interface Foo { 2. int k = 4: 3. } Which three are equivalent to line 2?()
第8题:
Which three form part of correct array declarations?()
第9题:
Which two code fragments correctly create and initialize a static array of int elements?()
第10题:
A
B
C
D
第11题:
public int a []
static int [] a
public [] int a
private int a [3]
private int [3] a []
public final int [] a
第12题:
x
y
i
j
第13题:
A.final int num1 = 10;
B.static int num2 = 20;
C.abstract int num3 = 30;
D.private int num4 = 40;
第14题:
A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.()
第15题:
现有: public class TestDemo{ private int X-2; static int y=3; public void method(){ final int i=100; int j =10; class Cinner { public void mymethod(){ //Here } } } } 在Here处可以访问的变量是哪些?()
第16题:
下列最终属性i的定义中,正确的是()。
第17题:
下列有关整型的最终属性i的定义正确的是()。
第18题:
public class TestDemo{ private int x = 2; static int y = 3; public void method(){ final int i=100; int j = 10; class Cinner{ public void mymethod(){ //Here } } } } 在Here处可以访问的变量是哪些?()
第19题:
1. class Passer2 { 2. //insert code here 3. static int bigState = 42; 4. public static void main(String [] args) { 5. bigState = p2.go(bigState); 6. System.out.print(bigState); 7. } 8. int go(int x) { 9. return ++x; 10. } 11. } 和4段代码片段: static Passer2 p2 = new Passer2(); final static Passer2 p2 = new Passer2(); private static Passer2 p2 = new Passer2(); final private static Passer2 p2 = new Passer2(); 有多少行分别插入到第2行,可以编译?()
第20题:
public interface Foo{ int k = 4; } Which three are equivalent to line 2? ()
第21题:
X
y
j
i
第22题:
static final int[]a={100,200};
static final int[]a;static{a=new int[2];a[0]=100;a[1]=200;}
static final int[]a=new int[2]{100,200};
static final int[]a;static void int(){a=new int[3];a[0]=100;a[1]=200;}
第23题:
public int MAX_LENGTH=100;
final int MAX_LENGTH=100;
final public int MAX_LENGTH=100;
public final int MAX_LENGTH=100;
第24题:
static final int[] a = { 100,200 };
static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }
static final int[] a = new int[2] { 100,200 };
static final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }