单选题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 {}

单选题
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 {}


参考解析

解析: 暂无解析

相关考题:

下列程序的运行结果是【 】。public class Test {public static void main (String args[]) {String s1="hello!";System.out.println (s1.toUpperCase());}}

下列程序段的输出结果是( )。 String MyStr="Hello,"; MyStr=MyStr+ "World!"; System.out.println(MyStr);A.Hello, World!B.Hello,C.World!D.该程序段有语法错误

下列Applet程序中,指定s为字符串类型,将s绘制在屏幕上,请将程序补充完整。import java.applet.Applet;import java.awt.Craphics;public class testl8_1 extends Applet {______String s;public void init (){s=new String("Hello World");}public Void______(Graphics g) {g.______(s,10,25);}}

A Windows Communication Foundation (WCF) solution uses the following contracts. (Line numbers are included for reference only.)01 [ServiceContract(CallbackContract=typeof(INameService))]02 public interface IGreetingService03 {04 [OperationContract]05 string GetMessage();06 }07 [ServiceContract]08 public interface INameService09 {10 [OperationContract]11 string GetName();12 }The code that implements the IGreetingService interface is as follows:20 public class GreetingService : IGreetingService21{22 public string GetMessage()23 {24 INameService clientChannel = OperationContext.Current.GetCallbackChannel();25 string clientName = clientChannel.GetName();26 return String.Format(Hello {0}, clientName);27 }28 }The service is self-hosted. The hosting code is as follows:30 ServiceHost host = new ServiceHost(typeof(GreetingService));31 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);32 host.AddServiceEndpoint(MyApplication.IGreetingService, binding, net.tcp//localhost:12345);33 host.Open();The code that implements the lNameService interface is as follows:40 class NameService : INameService41 {42 string name;43 public NameService(string name)44 {45 this.name = name;46 }47 public string GetName()48 {49 return name;50 }51 }Currently, this code fails at runtime, and an InvalidOperationException is thrown at line 25. You need to correct the code so that the call from the service back to the client completes successfully. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)()

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());}}这个错误不容易发现。

写出程序运行的结果Public class BasePublic virtual string Hello() {return “Base”;}Public class Sub:BasePublic override string Hello() {return “Sub”;}1. Base b = new Base(); b.Hello;2. Sub s = new Sub(); s.Hello;3. Base b = new Sub (); b.Hello;4. Sub s = new Base(); s.Hello;

下列程序段的输出结果是 String MyStr = "Hello,"; MyStr = MyStr + "World!"; System.out.println(MyStr);A.Hello,World!B.Hello,C.World!D.该程序段有语法错误

下列程序段的输出是( )。 public class Test { public static void main (String args[ ]) { String ss1 = new String("hello"); String ss2 = new String("hello"); System.out.println(ssl == ss2); System.out.println (ssequals(ss2)); } }A.true, falseB.true, trueC.false, trueD.false, false

下面的代码实现一个简单的Applet: import java.applet.Applet; import java.awt.*; public class Sample extends Applet { private String text="Hello World"; public void init() { add(new Label(text)); } public Sample(String string) { text=string; } } 通过下面的HTML文件访问: <html> <title>Sample Applet</title> <body> <applet code="Sample.class"width=200 height=200></applet> </body> </html> 当编译和运行该小程序时会出现什么结果,请选择正确的答案。( )A.将会出现“Hello World"B.将会产生一个运行时错误C.什么都没有D.产生一个编译时错误

编译和运行以下代码的结果为:public class MyMain{public static void main(String argv){System.out.println("Hello cruel world");}} A.编译错误;B.运行输出 "Hello cruel world";C.编译无错,但运行时指示没有定义构造方法。D.编译无错,但运行时指示没有正确定义main方法。

下列选项中,()是正确的表达式。 A、% String s = “hello world ” ;%  B、% = “hello world ” ;% C、% = “hello world ” %  D、% ! “hello world ” %

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 {}

public class Foo {   public void main (String args) {   system.out.printIn(“Hello World.”);   }   }   What is the result? () A、 An exception is thrown.B、 The code does no compile.C、 “Hello World.” Is printed to the terminal.D、 The program exits without printing anything.

public class Foo {  public void main( String[] args ) {  System.out.println( “Hello” + args[0] );  }  }   What is the result if this code is executed with the command line?()A、 HelloB、 Hello FooC、 Hello worldD、 Compilation fails.E、 The code does not run.

class A {  public A() {  System.out.println(“hello from a”);  }  }  class B extends A {  public B () {  System.out.println(“hello from b”);  super();  }  }  public class Test {  public static void main(String args[]) {  A a = new B();  }  }   What is the result when main is executed?()  A、 Compilation fails.B、 hello from aC、 hello from bD、 hello from b hello from aE、 hello from a hello from b

public class X {   public static void main (String[]args)   {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s)  {   s += “world!”;      }   }      What is the result?()    A、 The program runs and prints “Hello”B、 An error causes compilation to fail.C、 The program runs and prints “Hello world!”D、 The program runs but aborts with an exception.

public class X {   public static void main (Stringargs) {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s) {   s += “world!”;   }   }   What is the result?() A、The program runs and prints “Hello”B、An error causes compilation to fail.C、The program runs and prints “Hello world!”D、The program runs but aborts with an exception.

10. public class Hello {  11. String title;  12. int value;  13. public Hello() {  14. title += “ World”;  15. }  16. public Hello(int value) {  17. this.value = value;  18. title = “Hello”;  19. Hello();  20. }  21. }  and:  30. Hello c = new Hello(5);  31. System.out.println(c.title);  What is the result?() A、 HelloB、 Hello WorldC、 Compilation fails.D、 Hello World 5E、 The code runs with no output.F、 An exception is thrown at runtime.

下列哪项是String的字面量?() A、“Hello”B、‘world’C、/u2345D、new String(“good”)

单选题class A {  public A() {  System.out.println(“hello from a”);  }  }  class B extends A {  public B () {  System.out.println(“hello from b”);  super();  }  }  public class Test {  public static void main(String args[]) {  A a = new B();  }  }   What is the result when main is executed?()A Compilation fails.B hello from aC hello from bD hello from b hello from aE hello from a hello from b

单选题public class X {   public static void main (Stringargs) {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s) {   s += “world!”;   }   }   What is the result?()AThe program runs and prints “Hello”BAn error causes compilation to fail.CThe program runs and prints “Hello world!”DThe program runs but aborts with an exception.

单选题What will be written to the standard output when the following program is run?()   public class Q03e4 {   public static void main(String args[]) {   String space = " ";   String composite = space + "hello" + space + space;   composite.concat("world");   String trimmed = composite.trim();   System.out.println(trimmed.length());   }   }A5B6C7D12E13

单选题下列哪项是String的字面量?()A“Hello”B‘world’C/u2345Dnew String(“good”)

单选题public class Foo {  public void main (String [] args)   {  system.out.printIn(“Hello World.”); } }  What is the result?()A An exception is thrown.B The code does no compile.C “Hello World.” Is printed to the terminal.D The program exits without printing anything.

单选题public class X {   public static void main (String[]args)   {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s)  {   s += “world!”;      }   }      What is the result?()A The program runs and prints “Hello”B An error causes compilation to fail.C The program runs and prints “Hello world!”D The program runs but aborts with an exception.

单选题Which SELECT statement will the result ‘ello World’ from the string ‘Hello World’?()ASELECT SUBSTR( ‘Hello World’,1) FROM dual;BSELECT INITCAP(TRIM (‘Hello World’, 1,1)) FROM dual;CSELECT LOWER(SUBSTR(‘Hello World’, 1, 1) FROM dual;DSELECT LOWER(SUBSTR(‘Hello World’, 2, 1) FROM dual;ESELECT LOWER(TRIM (‘H’ FROM ‘Hello World’)) FROM dual;

单选题下列选项中,()是正确的表达式。A% String s = “hello world ” ;%  B% = “hello world ” ;% C% = “hello world ” %  D% ! “hello world ” %