题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-07-02 01:17:13

[单项选择] //point X    public class foo (   public static void main (Stringargs) throws Exception {   printWriter out = new PrintWriter (new )  java.io.outputStreamWriter (System.out), true;   out.printIn(“Hello”);    }   )   Which statement at PointX on line 1 allows this code to compile and run?()
A.  Import java.io.PrintWriter;
B.  Include java.io.PrintWriter;
C.  Import java.io.OutputStreamWriter;
D.  Include java.io.OutputStreamWriter;
E.  No statement is needed.

更多"//point X    pu"的相关试题:

[多项选择] class A {  }  class Alpha {  private A myA = new A();  void dolt( A a ) {  a = null;  }  void tryIt() {  dolt( myA );  }  }  Which two statements are correct?()  
A.  There are no instanced of A that will become eligible for garbage collection.
B.  Explicitly setting myA to null marks that instance to be eligible for garbage collection.
C.  Any call on tryIt() causes the private instance of A to be marked for garbage collection.
D.  Private instances of A become eligible for garbage collection when instances of Alpha become eligible for garbage collection.
[单项选择] 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. 编译失败
[多项选择] class ClassA {}  class ClassB extends ClassA {}  class ClassC extends ClassA {}  and:  ClassA p0 = new ClassA();  ClassB p1 = new ClassB();  ClassC p2 = new ClassC();  ClassA p3 = new ClassB();  ClassA p4 = new ClassC();  Which three are valid?()
A.  p0 = p1;
B.  p1 =p2;
C.  p2 = p4;
D.  p2 = (ClassC)p1;
E.  p1 = (ClassB)p3;
F.  p2 = (ClassC)p4;
[多项选择] Given: class ClassA {} class ClassB extends ClassA {} class ClassC extends ClassA {} and: ClassA p0 = new ClassA(); ClassB p1 = new ClassB(); ClassC p2 = new ClassC(); ClassA p3 = new ClassB(); ClassA p4 = new ClassC(); Which three are valid?()
A. p0 = p1;
B. p1 = p2;
C. p2 = p4;
D. p2 = (ClassC)p1;
E. p1 = (ClassB)p3;
F. p2 = (ClassC)p4;
[单项选择] 现有:     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. 运行时抛出异常
[单项选择] 现有:  class  Ifs  {  public  static void main (String  []  args)  {      boolean state=false;      int i=2;  if( (++i>2)  &&  (state=true))     i++;  if( (++i>4)  l l  (state=false))      i++;  System.out .println (i);     }     } 结果为:()     
A.   6
B.   5
C.   4
D. 编译失败
[单项选择] 现有:  class  Test4  {  public static void main (String  []  args)  {    boolean X=true;   boolean y=false;    short Z=42;    if((z++==42)  &&  (y=true))z++;    if((x=false)  ||    (++z==45))  z++;    System. out.println(¨z=”+z);     }    }  结果为:() 
A.   Z=42
B.   z=44
C.   Z= 45
D.   z= 46
[多项选择]  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  TestDemo{     private int X-2;      static int y=3;  public  void method(){      final int i=100;      int j  =10;     class Cinner {  public void mymethod(){      //Here     }     }     }     } 在Here处可以访问的变量是哪些?() 
A. X
B. y
C. j
D. i
[单项选择] 现有:      class TestA  {  public void start()  {  System.out.println("TestA");  }     }  public class TestB extends TestA  {  public void start()  {  System.out.println("TestB");  }     public static void main (string[]  args)  (     ((TestA)new TestB()).start();     )     }  运行结果是哪项?()     
A.   TeStA
B.   TeStB
C. 编译失败
D. 运行时抛出异常
[单项选择] 现有:      class Pencil  {  public void write (String content){     System.out.println( "Write",+content){     }     }class RubberPencil extends Pencil{     public void write (String content){  System.out.println("Rubber Write"+content);     }  public void erase (String content)}}  执行下列代码的结果是哪项?()      Pencil  pen=new  Pencil();  (( RubberPencil) pen).write( "Hello");    
A. Write Hello
B. Rubber Write Hello
C. 编译失败
D. 运行时抛出异常
[单项选择]  public class ArrayTest {   public static void main (Stringargs) {   float f1, f2;   f1 = new float [10];  f2 = f1;   System.out.printIn (“f2[0]=” + f2[0]);   }  }   What is the result?()
A.  It prints f2[0] = 0.0
B.  It prints f2[0] = NaN
C.  An error at line 5 causes compile to fail.
D.  An error at line 6 causes compile to fail.
E.  An error at line 6 causes an exception at runtime.
[单项选择] public class MyExample{    public static void main(String args[])    {         System.out.println(args[2])   }} 如果以下列命令行运行:  java MyExample Aptech online 上述代码将输出()。 
A. MyExample
B. Aptech
C. Online
D. 产生异常: "java.lang.ArrayIndexOutOfBoundsException"

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码