关于下面程序,哪些结论是正确的?
import java.awt.*;
import javax.swing.*;
public class J_Test extends JFrame{
public static void main(String args[]){
J_Test app=new J_Test();
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container ct=app.getContentPane();
String[] d={"One","Two","Three","Four","Five"};
int[] s={2,3};
JList t=new JList(d);
t.setSelectedIndices(s);
ct.add(t);
app.setSize(250,160);
app.setVisible(true);
}
}
A 程序可以通过编译并正常运行,结果在程序的界面上出现一个列表框,其中选项“Two”和“Three”被选中
B 程序可以通过编译并正常运行,结果在程序的界面上出现一个列表框,其中选项“Three”和“Four”被选中
C 程序可以通过编译并正常运行,结果在程序的界面上出现一个列表框,其中选项“Three”被选中
D 程序无法通过编译
import java.awt.*;
import javax.swing.*;
public class J_Test extends JFrame{
public static void main(String args[]){
J_Test app=new J_Test();
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container ct=app.getContentPane();
String[] d={"One","Two","Three","Four","Five"};
int[] s={2,3};
JList t=new JList(d);
t.setSelectedIndices(s);
ct.add(t);
app.setSize(250,160);
app.setVisible(true);
}
}
A 程序可以通过编译并正常运行,结果在程序的界面上出现一个列表框,其中选项“Two”和“Three”被选中
B 程序可以通过编译并正常运行,结果在程序的界面上出现一个列表框,其中选项“Three”和“Four”被选中
C 程序可以通过编译并正常运行,结果在程序的界面上出现一个列表框,其中选项“Three”被选中
D 程序无法通过编译