现有: public interface A {} 以下哪项声明是合法的?()
A . A a = new A();
B . A[] a = new A[];
C . A[] a = new A[10];
D . 以上皆错
相似题目
-
public interface Foo{ int k = 4; } Which three are equivalent to line 2?()
A . Final int k = 4;
B . Public int k = 4;
C . Static int k = 4;
D . Private int k = 4;
E . Abstract int k = 4;
F . Volatile int k = 4;
-
public interface Foo { int k = 4; 3. } Which three are equivalent to line 2?()
A . final int k = 4;
B . public int k = 4;
C . static int k = 4;
D . abstract int k = 4;
E . volatile int k = 4;
F . protected int k = 4;
-
Given:10. interface Data { public void load(); }11. abstract class Info { public abstract void load(); }Which class correctly uses the Data interface and Info class?()()
A .https://assets.asklib.com/images/image2/2018080210481836686.jpg
B .https://assets.asklib.com/images/image2/2018080210482719010.jpg
C .https://assets.asklib.com/images/image2/2018080210483486806.jpg
D .https://assets.asklib.com/images/image2/2018080210483925433.jpg
E .https://assets.asklib.com/images/image2/2018080210484613654.jpg
F .https://assets.asklib.com/images/image2/2018080210485087701.jpg
-
public interface A { String DEFAULT_GREETING = “Hello World”; public void method1(); } A programmer wants to create an interface called B that has A as its parent. Which interface declaration is correct?()
A . public interface B extends A {}
B . public interface B implements A {}
C . public interface B instanceOf A {}
D . public interface B inheritsFrom A {}
-
1. interface TestA { String toString(); } 2. public class Test { 3. public static void main(String[] args) { 4. System.out.println(new TestA() { 5. public String toString() { return “test”; } 6. } 7. } 8. } What is the result?()
A . test
B . null
C . An exception is thrown at runtime.
D . Compilation fails because of an error in line 1.
E . Compilation fails because of an error in line 4.
F . Compilation fails because of an error in line 5.
-
You are designing a strategy to allow users to have remote access to internal resources. Which service or services should you allow on the public interface of the NAT Server?()
A . HTTP
B . LDAP
C . POP3
D . SMTP
E . VPN Gateway
-
Given: 10.interface Data { public void load(); } 11.abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?()
A .https://assets.asklib.com/images/image2/2018080114295971472.png
B .https://assets.asklib.com/images/image2/2018080114300659438.png
C .https://assets.asklib.com/images/image2/2018080114301390095.png
D .https://assets.asklib.com/images/image2/2018080114301865887.png
-
现有: interface Data {public void load();} abstract class Info {public abstract void load();} 下列类定义中正确使用Data和Info的是哪项?()
A . public class Employee implements Info extends Data { public void load(){/*dosomething*/} }
B . public class Employee extends Inf.implements Data{ public void load() {/*do something*/} }
C . public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/} public void load(){/*do something*/} }
D . public class Employee extends Inf implements Data { public void Data.1oad() {/*do something*/) public void info.1oad(){/*do something*/} }
-
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*/ } }
-
现有: class Test2 f public static void main (String [] args) { short a,b,C; a=l; b=2; C=a+b; a+=2: } 以上代码中,哪一句是错误的?()
A . a=1:
B . C=a+b;
C . a+=2;
D . short a,b,C;
-
现有: class A {public String name="a"} class B extends A {public String name="b"} 执行如下代码后的结果是哪项?() A a=new B(); System.out.println(a.name);
A . a
B . b
C . 编译失败
D . 运行时抛出异常
-
现有: public interface A {} 以下哪项声明是合法的?()
A . a = new A();
B . A[] a = new A[];
C . A[] a = new A[10];
D . 以上皆错
-
现有: interface I { void go(); } abstract class A implements I { } class C extends A { void go(){ } } 结果是什么?()
A . 代码通过编译
B . 由于第1行的错误导致编译失败
C . 由于笫3行的错误导致编译失败
D . 由于第6行的错误导致编译失败
-
Given: 1. public interface Foo { 2. int k = 4: 3. } Which three are equivalent to line 2?()
A . final int k = 4:
B . public int k = 4:
C . static int k = 4:
D . private int k = 4:
E . abstract int k = 4:
F . volatile int k = 4:
G . transient int k = 4:
H . protected int k = 4:
-
interface Altitude { //insert code here } 和4个声明: int HIGH = 7; public int HIGH = 7; abstract int HIGH = 7; interface int HIGH = 7; 分别插入到第2行,有多少行可以编译?()
A . 0
B . 1
C . 2
D . 3
E . 4
-
interface A { public int getValue() } class B implements A { public int getValue() { return 1; } } class C extends B { // insert code here } Which three code fragments, inserted individually at line 15, make use of polymorphism?()
A . public void add(C c) { c.getValue(); }
B . public void add(B b) { b.getValue(); }
C . public void add(A a) { a.getValue(); }
D . public void add(A a, B b) { a.getValue(); }
E . public void add(C c1, C c2) { c1.getValue(); }
-
读代码:1. public interface Foo{2.int k = 4;3. }Which three are equivalent to line 2? (Choose Three)
-
接口(interface)是指只含有公有抽象方法(public abstract method)的类。这些方法必须在()中被实现。
-
下列接口中标注的(A,B,C,D)中,哪两个是错误的? interface Takecare { protected void speakHello(); //A public abstract static void cry(); //B int f(); //C abstract float g(); //D }
A.A
B.B
C.C
D.D
-
请依次说出【代码1】-【代码2】的输出结果。注意:结果之间用英文的分号分隔 interface A{ double f(double x, double y); } class B implements A{ public double f(double x, double y){ return x*y; } int g(int a, int b){ return a+b; } } public class E{ public static void main(String args[]){ A a=new B(); System.out.println(a.f(3,5)); // 【代码1】 B b=(B)a; System.out.println(b.g(3,5)); // 【代码2】 } }
-
现有:  public interface A {}  以下哪项声明是合法的() 
A.ensp;= new A;
B. A[] a = new A[];
C. A[] a = new A[10];
D. 以上皆错
-
public class InterfaceDemo implements A,B{ @Override public void f(){ // TODO Auto-generated method stub }}interface A{ void f()throws IOException;}interface B{ void f()throws ClassNotFoundException;}
A.什么都不写
B.throws IOException
C.throws ClassNotFoundException
D.throws IOException,ClassNotFoundException
-
31、实现interface的方法前一定要用public修饰
-
以下代码运行后输出的内容()interface AAA{ void fun(); } class BBB extends AAA{ public void fun() { System.out.println("fun"); } } public class Main { public static void main(String[] args) { AAA a = new BBB(); a.fun(); } }
A.fun
B.无输出
C.输出内容不确定
D.程序错误,无法运行