网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
现有: public interface A {} 以下哪项声明是合法的?()
- A、a = new A();
- B、 A[] a = new A[];
- C、 A[] a = new A[10];
- D、 以上皆错
参考答案
更多 “ 现有: public interface A {} 以下哪项声明是合法的?() A、a = new A();B、 A[] a = new A[];C、 A[] a = new A[10];D、 以上皆错” 相关考题
考题
本题中,用表格表现某个月的月历,其中标题是从Sunday到Saturday,表格中的各项是可以修改的。 import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; public class java2 ( public static void main(String[]args) { try{ UIManager.setLookAndFeel(UIManager.getSys- temLookAndFeelClassName): } catch(Exception e) JFrame. frame=new CalendarTableFrame; frame.setDefaultCloseOperation(JFrame.EXIT_ oN CLOSE); frame.show; } } clasgCalendarTableFrame. extends JFrame { private static final int WIDTH=500; private static final int HEIGHT=150: private cells= { {null,null,null,new Integer(1),new Integer (2),new Integer(3),new Integer(4)), {new Integer(5),new Integer(6),new Integer (7).new Integer(8),new Integer(9),new Integer (10),new Integer(11)), {new Integer(12),new Integer(13),new Integer (14),new Integer(15),new Integer(16),new Integer (17),new Integer(18)), {new Integer(19),new Integer(20),new Integer (21),new Integer(22),new Integer(23),new Integer (24),new Integer(25)), {new Integer(26),new Integer(27),new Integer (28),new Integer(29),new Integer(30),new Integer (31),null} }; private String[]columnNames={ "Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday" }; public CalendarTableFrame{ setTitle("java2"); setSize(WIDTH,HEIGHT); JTable table=new ; getContentPane.add(new JScrollPane(table), BorderLayout.CENTER); } }
考题
设A为已定义的类名,下列声明A类的对象a的语句中正确的是()A.float Aa;B.Public Aa=A();C.Aa=new int();D.static Aa=new A();
考题
设A为已定义的类名,则下列声明A类的对象a的语句中正确的一项是A.public A a=new A();B.public A a=A();C.A a=new class();D.aA;
考题
设A为已定义的类名,下列是声明A类的对象a的语句中正确的是A.public A a=new A( );B.public A a=A();C.A a=new class();D.a A;
考题
interface Playable {void play();}interface Bounceable {void play();}interface Rollable extends Playable, Bounceable {Ball ball = new Ball("PingPang");}class Ball implements Rollable {private String name;public String getName() {return name;}public Ball(String name) {this.name = name;}public void play() {ball = new Ball("Football");System.out.println(ball.getName());}}这个错误不容易发现。
考题
设A为已定义的类名,则下列声明A类的对象a的语句中正确的是( )。A.public A a=new A();B.public A a=A();C.A a=new class();D.a A;
考题
设有类定义如下:class Base{public Base(int i){}}public class MyOver extends Base{public static void main(String arg[]){MyOver m = new MyOver(10);}MyOver(int i){super(i);}MyOver(String s, int i){this(i);//Here}}以下哪条语句可以安排在//Here处 ?A.MyOver m = new MyOver();B.super();C.this("Hello",10);D.Base b = new Base(10);
考题
1. public class Outer{ 2. public void someOuterMethod() { 3. // Line 3 4. } 5. public class Inner{} 6. public static void main( String[]argv ) { 7. Outer o = new Outer(); 8. // Line 8 9. } 10. } Which instantiates an instance of Inner?() A、 new Inner(); // At line 3B、 new Inner(); // At line 8C、 new o.Inner(); // At line 8D、 new Outer.Inner(); // At line 8
考题
现有:D - f 是一个对 java.io.File 实例的合法引用 - fw 是一个对 java.io.FileWriter 实例的合法引用 - bw 是一个对 java.io.BufferedWriter 实例的合法引用 以下哪一项无效?() A、 PrintWriter prtWtr = new PrintWriter(f);B、 PrintWriter prtWtr = new PrintWriter(fw);C、 PrintWriter prtWtr = new PrintWriter(bw);D、 BufferWriter bufWtr = new BufferedWriter(f);E、 BufferWriter bufWtr = new BufferedWriter(fw);F、 BufferWriter bufWtr = new BufferedWriter(bw);
考题
下面哪一个是合法的数组声明和构造语句()A、 int[] ages = [100];B、 int ages = new int[100];C、 int[] ages = new int[100];D、 int() ages = new int(100);
考题
下面哪个语句正确地声明一个整型的二维数组?()A、int a[ ][ ] = new int[][];B、int a[10][10] = new int[][];C、int a[ ][ ] = new int[10][10];D、int [ ][ ]a = new int[10][10];E、int [ ]a[ ] = new int[10][10];
考题
interface Animal { void soundOff(); } class Elephant implements Animal { public void soundOff() { System.out.println(“Trumpet”); } } class Lion implements Animal { public void soundOff() { System.out.println(“Roar”); } } class Alpha1 { static Animal get( String choice ) { if ( choice.equalsIgnoreCase( “meat eater” )) { return new Lion(); } else { return new Elephant(); } } } Which compiles?() A、 new Animal().soundOff();B、 Elephant e = new Alpha1();C、 Lion 1 = Alpha.get(“meat eater”);D、 new Alpha1().get(“veggie”).soundOff();
考题
Which two code fragments will execute the method doStuff() in a separate thread?()A、 new Thread() { public void run() { doStuff(); } }B、 new Thread() { public void start() { doStuff(); } }C、 new Thread() { public void start() { doStuff(); } } .run();D、 new Thread() { public void run() { doStuff(); } } .start();E、 new Thread(new Runnable() { public void run() { doStuff(); } } ).run();F、 new Thread(new Runnable() { public void run() { doStuff(); } }).start();
考题
现有: - f 是一个对 java.io.File 实例的合法引用 - fw 是一个对 java.io.FileWriter 实例的合法引用 - bw 是一个对 java.io.BufferedWriter 实例的合法引用 以下哪一项无效?() A、 PrintWriter prtWtr = new PrintWriter(f);B、 PrintWriter prtWtr = new PrintWriter(fw);C、 PrintWriter prtWtr = new PrintWriter(bw);D、 BufferWriter bufWtr = new BufferedWriter(f);E、 BufferWriter bufWtr = new BufferedWriter(fw);F、 BufferWriter bufWtr = new BufferedWriter(bw);
考题
对于如下代码,描述正确的是哪项?() class Student{ public static void main(String[] args){ Student student=new Student(); } } A、new Student()创建了Student对象的一个实例B、Student student声明了对象Student的一个引用C、class Student声明了一个类D、new Student()创建了一个类E、Student student 声明了一个类
考题
现有: -f是一个对java .io.File实例的合法引用 - fw足‘个对java.io.FileWriter实例的合法引用 - bw足一个对java.io.BufferedWriter实例的合法引用 以下哪一项无效?() A、PrintWriter prtWtr = new PrintWriter (f);B、PrintWriter prtWtr = new PrintWriter( fw);C、PrintWriter prtWtr = new PrintWriter(bw):D、BufferWriter bufWtr = new BufferedWritr(f);E、BufferWriter bufWtr = new BufferedWriter(fw);F、BufferWriter bufWtr = new BufferedWriter (bw):
考题
Which two code fragments will execute the method doStuff() in a separate thread?()A、new Thread() {public void run() { doStuff(); }};B、new Thread() {public void start() { doStuff(); }};C、new Thread() {public void start() { doStuff(); }}.run();D、new Thread() {public void run() { doStuff(); }}.start();E、new Thread(new Runnable() {public void run() { doStuff(); }}).start();
考题
单选题现有: public interface A {} 以下哪项声明是合法的?()A
a = new A();B
A[] a = new A[];C
A[] a = new A[10];D
以上皆错
考题
单选题现有: -f是一个对java .io.File实例的合法引用 - fw足‘个对java.io.FileWriter实例的合法引用 - bw足一个对java.io.BufferedWriter实例的合法引用 以下哪一项无效?()A
PrintWriter prtWtr = new PrintWriter (f);B
PrintWriter prtWtr = new PrintWriter( fw);C
PrintWriter prtWtr = new PrintWriter(bw):D
BufferWriter bufWtr = new BufferedWritr(f);E
BufferWriter bufWtr = new BufferedWriter(fw);F
BufferWriter bufWtr = new BufferedWriter (bw):
考题
单选题现有: public interface A {} 以下哪项声明是合法的?()A
A a = new A();B
A[] a = new A[];C
A[] a = new A[10];D
以上皆错
考题
多选题下面哪个语句正确地声明一个整型的二维数组?()Aint a[ ][ ] = new int[][];Bint a[10][10] = new int[][];Cint a[ ][ ] = new int[10][10];Dint [ ][ ]a = new int[10][10];Eint [ ]a[ ] = new int[10][10];
考题
单选题现有:D - f 是一个对 java.io.File 实例的合法引用 - fw 是一个对 java.io.FileWriter 实例的合法引用 - bw 是一个对 java.io.BufferedWriter 实例的合法引用 以下哪一项无效?()A
PrintWriter prtWtr = new PrintWriter(f);B
PrintWriter prtWtr = new PrintWriter(fw);C
PrintWriter prtWtr = new PrintWriter(bw);D
BufferWriter bufWtr = new BufferedWriter(f);E
BufferWriter bufWtr = new BufferedWriter(fw);F
BufferWriter bufWtr = new BufferedWriter(bw);
热门标签
最新试卷