网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
public class Test {  public enum Dogs {collie, harrier};  public static void main(String [] args) {  Dogs myDog = Dogs.collie;  switch (myDog) {  case collie:  System.out.print(”collie “); case harrier:  System.out.print(”harrier “);  }  }  }  What is the result?()
A

 collie

B

 harrier

C

 Compilation fails.

D

 collie harrier

E

 An exception is thrown at runtime.


参考答案

参考解析
解析: 暂无解析
更多 “单选题public class Test {  public enum Dogs {collie, harrier};  public static void main(String [] args) {  Dogs myDog = Dogs.collie;  switch (myDog) {  case collie:  System.out.print(”collie “); case harrier:  System.out.print(”harrier “);  }  }  }  What is the result?()A  collieB  harrierC  Compilation fails.D  collie harrierE  An exception is thrown at runtime.” 相关考题
考题 下列关于Test类的定义中,正确的是______。A) class Test implements Runnabte{public void run(){}public void someMethod(){}B) class Test implements Rnuuable{public void run();}C) class Test implements Rnuuable{public void someMethod();}D) class Test implements Rnuuable{public void someMethod();{}}A.B.C.D.

考题 在如下源代码文件Test.java中, 哪个是正确的类定义?() A.public class test { public int x = 0; public test(int x) { this.x = x; } }B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }D.public class

考题 publicclassTest{publicenumDogs{collie,harrier};publicstaticvoidmain(String[]args){DogsmyDog=Dogs.collie;switch(myDog){casecollie:System.out.print(”collie);caseharrier:System.out.print(”harrier);}}}Whatistheresult?()A.collieB.harrierC.Compilationfails.D.collieharrierE.Anexceptionisthrownatruntime.

考题 publicclassTest{publicenumDogs{collie,harrier,shepherd};publicstaticvoidmain(String[]args){DogsmyDog=Dogs.shepherd;switch(myDog){casecollie:System.out.print(”collie);casedefault:System.out.print(”retriever);caseharrier:System.out.print(”harrier);}}}Whatistheresult?()A.harrierB.shepherdC.retrieverD.Compilationfails.E.retrieverharrierF.Anexceptionisthrownatruntime.

考题 下列哪个选项的java源文件代码片段是不正确的?A.package testpackage; public class Test{ }B.import java. io. *; package testpaekage; public class Test { }C.import java.io.*; class Person { } public class Test { }D.import java.io.*; import java. awt.*; public class Test{ }

考题 在下列源代码文件Test.java中,正确定义类的代码是( )。A.pblic class test { public int x=0; public test(int x) { this. x=x;} }B.public class Test { public int x=0; public Test(int x) { this. x=x;} }C.public class Test extends T1,T2{ public int x = 0; public Test(int x){ this. x = x; } }D.protected class Test extends T2{ public int x = 0; public Test(int x) { this. x = x; } }

考题 下面程序的运行结果为( )。 include using namespace std; class A{ pu 下面程序的运行结果为( )。 #include <iostream> using namespace std; class A{ public: A(){cout<<" ";} ~A(){cout<<" ";} } class B:public A{ public: B(){cout<<" ";} ~B(){cout<<" ";} } void main(){ B b; }A.1234B.1324C.1342D.3142

考题 下列哪个选项的java源文件程序段是不正确的? ( )A.package testpackage; public class Test{ }B.import java.io.*; package testpackage; public class Test{ }C.import java.i.*; class Person{} public class Test{ }D.import java.io.*; import java.awt.*; public class Test { }

考题 下列关于Test类的定义中,正确的是( )。A.class Test implements Runnable{ public void run{} Dublic void someMethod[]{} }B.class Test implements Runnable( puIblic void run; }C.class Test implements Runnable( Dublic void someMethod[]; }D.class Test implements Runnable( public void someMethod{} }

考题 在下列源代码文件Test.java中, ( )是正确的类定义。A.public class test{B.public class Test{ public int x=0;public int x=0; public test (intx) public Test (int x){ {this.x=x; this.x=x;} }} }C.public class Test extends T1,T2{D.protected class Test extends T2{ public int=0;public int x=0; public Test(int x){Public Test (int x){ this.x=x;this.x=x: }} }}

考题 在下列源代码文件Test.java中,哪个选项是正确的类定义? ( )A.public class test { public int x=0; public test(int x) { this.x=x; } }B.public class Test { public int x=0; public Test(int x) { this.x=x; } }C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }

考题 class Dog { }  class Harrier extends Dog { }  class DogTest {  public static void main(String [] args) {  Dog d1 = new Dog();  Harrier h1 = new Harrier();  Dog d2 = h1;  Harrier h2 = (Harrier) d2;  Harrier h3 = d2;  }  }  下面哪一项是正确的?() A、编译失败B、2个Dog对象被创建C、2个Harrier对象被创建D、3个Harrier对象被创建

考题 package test1;  public class Test1 {  static int x = 42;  }  package test2;  public class Test2 extends test1.Test1 {  public static void main(String[] args) { System.out.println(“x = “ + x);  }  }  What is the result?() A、 x = 0B、 x = 42C、 Compilation fails because of an error in line 2 of class Test2.D、 Compilation fails because of an error in line 3 of class Test1.E、 Compilation fails because of an error in line 4 of class Test2.

考题 Public class test (  Public static void main (String args[])  (  System.out.printIn (6 ^ 3);  )  )   What is the output?()

考题 public class Test {  public enum Dogs {collie, harrier, shepherd};  public static void main(String [] args) {  Dogs myDog = Dogs.shepherd;  switch (myDog) {  case collie:  System.out.print(”collie “);  case default:  System.out.print(”retriever “); case harrier:  System.out.print(”harrier “);  }  }  }  What is the result?() A、 harrierB、 shepherdC、 retrieverD、 Compilation fails.E、 retriever harrierF、 An exception is thrown at runtime.

考题 现有:  class Dog{ }  class Harrier extends Dog  { }       class DogTest{   public  static void main (String  []  args) {      Dog dl=new Dog();      Harrier hl=new Harrier();      Dog d2=hl;   Harrier h2=  (Harrier) d2;      Harrier h3=d2;     }      }  下面哪一项是正确的?()    A、2个Dog对象被创建B、2个Harrier对象被创建C、3个Harrier对象被创建D、编译失败

考题 public class Test {  public int aMethod() {  static int i = 0;  i++;  return i;  }  public static void main (String args[]) {  Test test = new Test();  test.aMethod();  int j = test.aMethod();  System.out.println(j);  }  }  What is the result?()  A、 0B、 1C、 2D、 Compilation fails.

考题 public class Test {  public enum Dogs {collie, harrier};  public static void main(String [] args) {  Dogs myDog = Dogs.collie;  switch (myDog) {  case collie:  System.out.print(”collie “); case harrier:  System.out.print(”harrier “);  }  }  }  What is the result?() A、 collieB、 harrierC、 Compilation fails.D、 collie harrierE、 An exception is thrown at runtime.

考题 public class Test {} What is the prototype of the default constructor?()  A、 Test()B、 Test(void)C、 public Test()D、 public Test(void)E、 public void Test()

考题 You work as an application developer at Certkiller .com. You have recently created a custom collection class named ShoppingList for a local supermarket. This custom class will include ShoppinItem objects that have the public properties listed below. * Name * AisleNumber * OnDiscount You are required to enable users of your class to iterate through the ShoppingList collection, and to list each product name and aisle number using the foreach statement.You need to achieve this by declaring the appropriate code.What code should you use?()A、 public class ShoppingList : ICollection {// Class implementation }B、 public class ShoppingList : IEnumerator, IEnumerable {// Class implementation }C、 public class ShoppingList : Ilist {// Class implementation }D、 public class ShoppingList : Enum {// Class implementation }

考题 单选题class Dog { }  class Harrier extends Dog { }  class DogTest {  public static void main(String [] args) {  Dog d1 = new Dog();  Harrier h1 = new Harrier();  Dog d2 = h1;  Harrier h2 = (Harrier) d2;  Harrier h3 = d2;  }  }  下面哪一项是正确的?()A 编译失败B 2个Dog对象被创建C 2个Harrier对象被创建D 3个Harrier对象被创建

考题 单选题现有:  class Dog{ }  class Harrier extends Dog  { }       class DogTest{   public  static void main (String  []  args) {      Dog dl=new Dog();      Harrier hl=new Harrier();      Dog d2=hl;   Harrier h2=  (Harrier) d2;      Harrier h3=d2;     }      }  下面哪一项是正确的?()A 2个Dog对象被创建B 2个Harrier对象被创建C 3个Harrier对象被创建D 编译失败

考题 单选题public class Test {  public enum Dogs {collie, harrier};  public static void main(String [] args) {  Dogs myDog = Dogs.collie;  switch (myDog) {  case collie:  System.out.print(”collie “); case harrier:  System.out.print(”harrier “);  }  }  }  What is the result?()A  collieB  harrierC  Compilation fails.D  collie harrierE  An exception is thrown at runtime.

考题 单选题public class Test {  public enum Dogs {collie, harrier, shepherd};  public static void main(String [] args) {  Dogs myDog = Dogs.shepherd;  switch (myDog) {  case collie:  System.out.print(”collie “);  case default:  System.out.print(”retriever “); case harrier:  System.out.print(”harrier “);  }  }  }  What is the result?()A  harrierB  shepherdC  retrieverD  Compilation fails.E  retriever harrierF  An exception is thrown at runtime.

考题 单选题package test1;  public class Test1 {  static int x = 42;  }  package test2;  public class Test2 extends test1.Test1 {  public static void main(String[] args) { System.out.println(“x = “ + x);  }  }  What is the result?()A  x = 0B  x = 42C  Compilation fails because of an error in line 2 of class Test2.D  Compilation fails because of an error in line 3 of class Test1.E  Compilation fails because of an error in line 4 of class Test2.

考题 填空题Public class test (    Public static void main (String args) (   System.out.printIn (6^3);   )   )   What is the output? ()

考题 单选题下列程序的运行结果是(  )。class Shape{ public Shape(){ System.out.print("Shape"); }}class Circle extends Shape{ public Circle(){ System.out.print("Circle"); }}public class Test{ public static void main(String[]args){ Shape d=new Circle(); }}A ShapeB CircleC ShapeCircleD 程序有错误

考题 单选题public class Test {} What is the prototype of the default constructor?()A  Test()B  Test(void)C  public Test()D  public Test(void)E  public void Test()