题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-21 13:54:52

[单项选择] 1. package foo;  2.    3. import java.util.Vector;  4.    5. private class MyVector extends Vector {  6. int i = 1;  7. public MyVector()  {  8. i = 2;  9.    }  10. }  11.    12. public class MyNewVector extends MyVector {  13. public MyNewVector ()  {  14. i = 4;  15. }  16. public static void main (String args [])  {  17. MyVector v = new MyNewVector();  18.   }  19. }     The file MyNewVector.java is shown in the exhibit.  What is the result?()  
A.  Compilation will succeed.
B.  Compilation will fail at line 5.
C.  Compilation will fail at line 6.
D.  Compilation will fail at line 14.
E.  Compilation will fail at line 17.

更多"1. package foo;  2.&"的相关试题:

[单项选择]  public class Foo {   public static void main (String []args) {   int i = 1;   int j = i++;   if ((i>++j) && (i++ ==j))  {           i +=j;          }        }      }   What is the final value of i?()  
A.  1
B.  2
C.  3
D.  4
E.  5
[单项选择] public class Foo {  static int[] a;  static { a[0]=2; }  public static void main( String[] args) {}  }  Which exception or error will be thrown when a programmer attempts to run this code?() 
A.  java.lang. StackOverflowError
B.  java.lang.IllegalStateException
C.  java.lang.ExceptionlnlnitializerError
D.  java.lang.ArraylndexOutOfBoundsException
[单项选择] public class foo {  static String s;  public static void main (String[]args) {  system.out.printIn (“s=” + s);  } }  What is the result?()  
A.  The code compiles and “s=” is printed.
B.  The code compiles and “s=null” is printed.
C.  The code does not compile because string s is not initialized.
D.  The code does not compile because string s cannot be referenced.
E.  The code compiles, but a NullPointerException is thrown when toString is called.
[单项选择] public class Foo {  public static void main(String[] args) {  try {  return;  } finally {  System.out.println( “Finally” );  }  }  }  What is the result?()
A.  Finally
B.  Compilation fails.
C.  The code runs with no output.
D.  An exception is thrown at runtime.
[单项选择] class Foo {  public static void main(String [] args) {  int x = 0;  int y = 4;  for(int z=0; z 〈 3; z++, x++) {  if(x 〉 1 & ++y 〈 10) y++;  }  System.out.println(y);  }  }  结果是什么?()  
A. 6
B. 7
C. 8
D. 10
[单项选择] public class foo {  public static void main (string[]args)  try {return;}  finally {system.out.printIn(“Finally”);}  }  What is the result?()
A.  The program runs and prints nothing.
B.  The program runs and prints “Finally”
C.  The code compiles, but an exception is thrown at runtime.
D.  The code will not compile because the catch block is missing.
[单项选择] package foo; public class Outer (  public static class Inner (  )  )   Which statement is true? () 
A.  An instance of the Inner class can be constructed with “new Outer.Inner ()”
B.  An instance of the inner class cannot be constructed outside of package foo.
C.  An instance of the inner class can only be constructed from within the outer class.
D.  From within the package bar, an instance of the inner class can be constructed with “new inner()”
[多项选择]  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 test (      private static int j = 0;  private static boolean methodB(int k) (  j += k;  return true;  )  public static void methodA(int  i)(  boolean b:     b = i < 10 | methodB (4);  b = i < 10 || methodB (8);  )  public static void main (String args[])(   methodA (0);  system.out.printIn(j);  )  )   What is the result?()  
A.  The program prints “0”
B.  The program prints “4”
C.  The program prints “8”
D.  The program prints “12”
E.  The code does not complete.
[填空题] Public class test (    Public static void stringReplace (String text) (    Text = text.replace („j„ , „i„);    )      public static void bufferReplace (StringBuffer text) (    text = text.append (“C”)   )      public static void main (String args ){  String textString = new String (“java”);    StringBuffer text BufferString = new StringBuffer (“java”);      stringReplace (textString);    BufferReplace (textBuffer);      System.out.printIn (textString + textBuffer);    }   )   What is the output?()
[单项选择] public class Foo {   public static void main (String args) {   int i = 1;   int j = i++;   if ((i>++j) && (i++ ==j)) {   i +=j;   }   }   }   What is the final value of i?()  
A.  1
B.  2
C.  3
D.  4
E.  5
[单项选择] public class foo {   public static void main (Stringargs) {  String s;   system.out.printIn (“s=” + s);   }   }   What is the result?()
A.  The code compiles and “s=” is printed.
B.  The code compiles and “s=null” is printed.
C.  The code does not compile because string s is not initialized.
D.  The code does not compile because string s cannot be referenced.
E.  The code compiles, but a NullPointerException is thrown when toString is called.
[单项选择] class Foo {  private int x;  publicFoo(intx) {this.x=x; }  public void setX( int x) { this.x = x; }  public int getX() { return x; }  }   public class Gamma {  static Foo fooBar( Foo foo) {  foo = new Foo( 100);  return foo;  }  public static void main( String[] args) {  Foo foo = new Foo( 300);  System.out.print( foo.getX() + “-“);  Foo fooFoo = fooBar( foo);  System.out.print( foo.getX() + “-“);  System.out.print( fooFoo.getX() + “-“);  foo = fooBar( fooFoo);  System.out.print( foo.getX() + “-“);  System.out.prmt( fooFoo.getX());  }  }  What is the output of this program?()
A.  300-100-100-100-100
B.  300-300-100-100-100
C.  300-300-300-100-100
D.  300-300-300-300-100

我来回答:

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

订单号:

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