网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
11. public enum Title { 12. MR(”Mr.”), MRS(”Mrs.”), MS(”Ms.”); 13. private final String title; 14. private Title(String t) { title = t; } 15. public String format(String last, String first) { 16. return title + “ “ + first + “ “ + last; 17. } 18. } 19. public static void main(String[] args) { 20. System.out.println(Title.MR.format(”Doe”, “John”)); 21. } What is the result?()
- A、 Mr. John Doe
- B、 An exception is thrown at runtime.
- C、 Compilation fails because of an error in line 12.
- D、 Compilation fails because of an error in line 15.
- E、 Compilation fails because of an error in line 20.
参考答案
更多 “ 11. public enum Title { 12. MR(”Mr.”), MRS(”Mrs.”), MS(”Ms.”); 13. private final String title; 14. private Title(String t) { title = t; } 15. public String format(String last, String first) { 16. return title + “ “ + first + “ “ + last; 17. } 18. } 19. public static void main(String[] args) { 20. System.out.println(Title.MR.format(”Doe”, “John”)); 21. } What is the result?() A、 Mr. John DoeB、 An exception is thrown at runtime.C、 Compilation fails because of an error in line 12.D、 Compilation fails because of an error in line 15.E、 Compilation fails because of an error in line 20.” 相关考题
考题
以下对枚举类型名的定义中正确的是( )。
A.Enum a={one,two,three};B.Enum a {a1,a2,a3};C.Enum a={''1'',''2'',''3''};D.Enum a {"one","two","three"};
考题
以下对枚举类型名的定义中正确的是______。A.enum a={one,two,three};B.enum a{on=9,two=-1,three};C.enum a={"one","two","three"};D.enum a{"one","two","three"};
考题
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.B.C.D.E.F.
考题
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序: Public Enum S a=4 b=3 End Enum Private Sub Command1 Click( ) Dim x As Integer x=a If x=3 Then MsgBox"Pass!" End Sub 运行程序,其结果是( )。A.运行错误.因为Enum定义有错B.运行错误.因为x=a类型不匹配C.运行正常结束,不显示任何信息D.运行正常.显示内容为“Pass!”的信息框
考题
以下对枚举类型名的定义中正确的是______。A.enum a={one,two,three};B.enum a{one=9,two=-1,three};C.enum a={"one","two","three"};D.enum a{"one","two","three"};
考题
以理对枚举类型名的定义中正确的是______。A.enum a={one, two, three);B.enum a {one=9, two=1three};C.enum a={"one", "two", "three"};D.enum a {"one", "two". "three"};
考题
10. public class ClassA { 11. public void count(int i) { 12. count(++i); 13. } 14. } And: 20. ClassA a = new ClassA(); 21. a.count(3); Which exception or error should be thrown by the virtual machine?() A、 StackOverflowErrorB、 NullPointerExceptionC、 NumberFormatExceptionD、 IllegalArgumentExceptionE、 ExceptionlnlnitializerError
考题
以下对枚举类型的定义,正确的是()A、 enum a={one,two,three};B、 enum a{a1,a2,a3};C、 enum a{‘1’,’2’,’3’};D、 enum a{ “one”,”two”,”three” };
考题
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.
考题
A JavaBeans component has the following field: 11. private boolean enabled; Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()A、 public void setEnabled( boolean enabled) public boolean getEnabled()B、 public void setEnabled( boolean enabled) public void isEnabled()C、 public void setEnabled( boolean enabled) public boolean isEnabled()D、 public boolean setEnabled( boolean enabled) public boolean getEnabled()
考题
以下对枚举类型名的定义中正确的是()。A、enum a {"sum","mon","tue"};B、enum a={sum,mon,tue};C、enum a={"sum","mon","tue"};D、enum a {sum=9,mon=-1,tue};
考题
11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12?()A、 finalB、 staticC、 nativeD、 publicE、 privateF、 abstractG、 protected
考题
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.
考题
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 }
考题
以下是一些C#中的枚举型的定义,其中错误的用法有()。A、public enum var1{Mike=100,Nike=102,Jike}B、public enum var1{Mike=100,Nike,Jike}C、public enum var1{Mike=-1,Nike,Jike}D、public enum var1{Mike,Nike,Jike}
考题
单选题10. interface Foo { int bar(); } 11. public class Sprite { 12. public int fubar( Foo foo) { return foo.bar(); } 13. public void testFoo() { 14. fubar( 15. // insert code here 16.); 17. } 18. } Which code, inserted at line 15, allows the class Sprite to compile?()A
Foo { public int bar() { return 1; } }B
new Foo { public int bar() { return 1; } }C
newFoo() { public int bar(){return 1; } }D
new class Foo { public int bar() { return 1; } }
考题
单选题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.
考题
多选题A JavaBeans component has the following field: 11. private boolean enabled; Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()Apublic void setEnabled( boolean enabled) public boolean getEnabled()Bpublic void setEnabled( boolean enabled) public void isEnabled()Cpublic void setEnabled( boolean enabled) public boolean isEnabled()Dpublic boolean setEnabled( boolean enabled) public boolean getEnabled()
考题
单选题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.
考题
单选题10. public class ClassA { 11. public void count(int i) { 12. count(++i); 13. } 14. } And: 20. ClassA a = new ClassA(); 21. a.count(3); Which exception or error should be thrown by the virtual machine?()A
StackOverflowErrorB
NullPointerExceptionC
NumberFormatExceptionD
IllegalArgumentExceptionE
ExceptionlnlnitializerError
考题
单选题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 }
考题
多选题package sun.scjp; public enum Color { RED, GREEN, BLUE } package sun.beta; // insert code here public class Beta { Color g = GREEN; public static void main( String[] argv) { System.out.println( GREEN); } } The class Beta and the enum Color are in different packages. Which two code fragments, inserted individually at line 2 of the Beta declaration, will allow this code to compile?()Aimport sun.scjp.Color.*;Bimport static sun.scjp.Color.*;Cimport sun.scjp.Color; import static sun.scjp.Color.*;Dimport sun.scjp.*; import static sun.scjp.Color.*;Eimport sun.scjp.Color; import static sun.scjp.Color.GREEN;
考题
多选题1. class Super { 2. private int a; 3. protected Super(int a) { this.a = a; } 4. } ..... 11. class Sub extends Super { 12. public Sub(int a) { super(a); } 13. public Sub() { this.a= 5; } 14. } Which two, independently, will allow Sub to compile?()AChange line 2 to: public int a;BChange line 2 to: protected int a;CChange line 13 to: public Sub() { this(5); }DChange line 13 to: public Sub() { super(5); }EChange line 13 to: public Sub() { super(a); }
考题
单选题10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to compile?()A
Direction d = NORTH;B
Nav.Direction d = NORTH;C
Direction d = Direction.NORTH;D
Nav.Direction d = Nav.Direction.NORTH;
考题
单选题11. public enum Title { 12. MR(”Mr.”), MRS(”Mrs.”), MS(”Ms.”); 13. private final String title; 14. private Title(String t) { title = t; } 15. public String format(String last, String first) { 16. return title + “ “ + first + “ “ + last; 17. } 18. } 19. public static void main(String[] args) { 20. System.out.println(Title.MR.format(”Doe”, “John”)); 21. } What is the result?()A
Mr. John DoeB
An exception is thrown at runtime.C
Compilation fails because of an error in line 12.D
Compilation fails because of an error in line 15.E
Compilation fails because of an error in line 20.
考题
单选题定义枚举如下: public enum Direction{ EAST,SOUTH,WEST,NORTH } 下列正确使用该枚举类型的语句是哪项?()A
Direction Direction=EAST;B
Direction direction=Direction.WEST;C
int a- Direction.NORTH;D
Direction direction=2;
考题
多选题11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12?()AfinalBstaticCnativeDpublicEprivateFabstractGprotected
考题
单选题以下对枚举类型的定义,正确的是()A
enum a={one,two,three};B
enum a{a1,a2,a3};C
enum a{‘1’,’2’,’3’};D
enum a{ “one”,”two”,”three” };
热门标签
最新试卷