更多"class A {  }  c"的相关试题:
[单项选择] 1. class Alpha { void m1() {} } 2. class Beta extends Alpha { void m2() { } } 3. class Gamma extends Beta { } 4. 5. class GreekTest { 6. public static void main(String [] args) { 7. a Alpha [] a = {new Alpha(), new Beta(), new Gamma() }; 8. for(Alpha a2 : a) { 9. a2.m1(); 10. if (a2 instanceof Beta || a2 instanceof Gamma) 11. //insert code here 12. } 13. } 14. } 哪一行代码插入到第11行,将编译但是会在运行时产生异常?()
A. a2.m2();
B. ((Beta)a2).m2();
C. ((Alpha)a2).m2();
D. ((Gamma)a2).m2();
[单项选择] public class Alpha{ public static void main( string[] args ){ if ( args.length == 2 ) { if ( args.[0].equalsIgnoreCase(“-b”) ) System.out.println( new Boolean( args[1] )); } } } And the code is invoked by using the command: java Alpha –b TRUE What is the result?()
A. true
B. null
C. false
D. Compilation fails.
E. The code runs with no output.
F. An exception is thrown at runtime.
[单项选择] public class Alpha{ private static Character() ids; public static void main( String[] args){ ids = new Character[args.length]; for (int i=0; iids[i] = new Character( args[i] ); System.out.print( ids[i] ); } } } What is correct?()
A. Compilation fails.
B. The code runs with no output.
C. An exception is thrown at runtime.
D. The code runs, outputing a concatenated list of the arguments passed to the program.
[单项选择] public class Alpha1 { public static void main( String[] args ) { boolean flag; int i=0; do { flag = false; System.out.println( i++ ); flag = i < 10; continue; } while ( (flag)? true:false ); } } What is the result?()
A. 000000000
B. 0123456789
C. Compilation fails.
D. The code runs with no output.
E. The code enters an infinite loop.
F. An exception is thrown at runtime.
[单项选择] 现有: 1. class Alpha { void m1() {} } 2. class Beta extends Alpha { void m2() { } } 3. class Gamma extends Beta { } 4. 5. class GreekTest { 6. public static void main(String [] args) { 7. Alpha [] a = {new Alpha(), new Beta(), new Gamma() }; 8. for(Alpha a2 : a) { 9. a2.m1(); 10. if (a2 instanceof Beta || a2 instanceof Gamma) 11. //insert code here 12. } 13. } 14. } 哪一行代码插入到第11行,将编译但是会在运行时产生异常?()
A. a2.m2();
B. ((Beta)a2).m2();
C. ((Alpha)a2).m2();
D. ((Gamma)a2).m2();
[单项选择] interface Beta {} class Alpha implements Beta { String testIt() { return “Tested”; } } public class Main1 { static Beta getIt() { return new Alpha(); } public static void main( String[] args ) { Beta b = getIt(); System.out.println( b.testIt() ); } } What is the result?()
A. Tested
B. Compilation fails.
C. The code runs with no output.
D. An exception is thrown at runtime.
[多项选择]
下列解释正确的是()
A. out_applet.java中一定有一个参数是“display_string”
B.
具有两个属性“name”和“value”
C. value是参数的名称
D. “good morning”通过
标记传递给“Our_Applet.class”
[简答题] 一般程序如下: ORG 2000H ARY DW --4,3,--2,1 CNT DW $--ARY VAR DW ARY,$+4 ┆ MOV AX,ARY MOV BX,OFFSET VAR MOV CX,CNT MOV DX,VAR+2 LEA SI,ARY ┆ 此程序段执行后,寄存器AX,BX,CX,DX与SI中的内容各是多少?
[单项选择] 现有: 1 Interface F{} 2 class A implements F{} 3 class B extends A{} 4 class C extends B{ 5 public static void main(String[] args){ 6 B b=new B(); 7 //inSert C0de here 8 } 9 } 下列哪行代码插入到第7行,将抛出java.lang.ClassCaseException异常()
A. A a=b;
B. F f= (C)b;
C. F f= (A)b;
D. B bb= (B)(A)b;
[单项选择] 现有: class Pencil { public void write (String content){ System.out.println ("Write"+content); } } class RubberPencil extends Pencil{ public void erase (String content){ System.out.println ("Erase"+content); } } 执行下列代码的结果是哪项?() Pencil pen=new RubberPencil(); pen.write ("Hello"); pen.erase ("Hello");
A. Write Hello Erase Hello
B. Erase Hello Write Hello
C. 编译错误
D. 运行时抛出异常
[多项选择] public class Foo { private int val; public foo(int v) (val = v;) } public static void main (String args) { Foo a = new Foo (10); Foo b = new Foo (10); Foo c = a; int d = 10; double e = 10.0; } Which three logical expression evaluate to true? ()
A. (a ==c)
B. (d ==e)
C. (b ==d)
D. (a ==b)
E. (b ==c)
F. (d ==10.0)
[单项选择] public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(String name){ System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?()
A. 23
B. 13
C. 123
D. 321
[单项选择] 现有 public class Parentt public void change (int x){) ) public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?()
A. protected void change (int x){}
B. public void change(int x, int y){}
C. public void change (int x){}
D. public void change (String s){}
[单项选择] class TestMain { static int x = 2; static { x = 4; } public static void main(String... args) { int y = x + 1; System.out.println(y); } } 和命令行: java TestMain 结果为:()
A. 3
B. 5
C. 编译失败
D. 运行时异常被抛出
[单项选择] A System p customer has installed components from the Linux ToolBox. By default, which of the following directories will contain the open source commands such as gzip, gunzip and zcat()
A. /opt/freeware/bin
B. /usr/bin/freeware
C. /var/freeware/bin
D. /usr/sbin/freeware
[单项选择] You work with a SQL Server 2005 database that provides banking information for customers. You want customers to see banking reports that combine data that is retrieved from the database with real-time investment information that comes from a Web service provided by a third party. The investment information must be current when the reports are executed. You need to create the appropriate objects that support the reports. What should you do?()
A. Publish the data in the database as an XML Web service by using the FOR XML AUTO clause.
B. Create a table to store the banking information for each customer. Create a trigger that fires when data is inserted into the table that joins with the data coming from the Web service.
C. Create a Transact-SQL stored procedure that uses a temporary table to store the banking information for each customer. Update the table with the values from the Web service.
D. Have a developer in your company create an assembly that calls the remote Web service. Create aCLR function by using the assembly. Call the CLR function and combine the results with banking information in the database.