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

[单项选择] package com.sun.sjcp; public class Commander{ public static void main(String[]args){ //more code here } } Assume that the class fileis located in /foo/com/sun/sjcp/,the current directory is/foo/,and that the classpath contains“.“(current directory). Which command line correctly runs Commander?()
A. java Commander
B. java com.sim.sjcp.Commander
C. java com/sun/sjcp/Commander
D. java-cpcom.sun.sjcp Commander
E. java-cpcom/sun/sjcp Commander

更多"package com.sun.sjcp; public class "的相关试题:

[单项选择]下列程序的执行结果是( )。   public class Testdd {    public static void main (String args[ ]){     inr a=lO,b=4,c=20,d=6;       System.out.println(a++*b+c,--D) ;    }   }
A. 300
B. 1200
C. 140
D. 144
[单项选择]下列程序的执行结果是( )。   public class Testcc {    public static void main (String args[ ])     {System.out.println(213.5f%4.0f);    }   }
A. 1.5
B. 1
C. 1.0
D. 0.5
[单项选择]下面程序的运行结果是( )。 public class Increment { public static void main(String args[ ] ){ int c; c=5; System. out. println(c) ; System. out. println(c++); System .out. println(c) ; } }
A. 5 6 6
B. 5 5 6
C. 6 7 7
D. 6 6 6
[单项选择]下列程序的执行结果是( )。    public class Testff{    public static void main(String args[]){     String sl=new String("I am boy");     String s2=new String("I am boy");      System.out.println(sl==s2);    }   }
A. true
B. false
C. "I am boy"
D. 都不正确
[多项选择] 11.public class Commander{ 12.public static void main(String[]args){ 13.String myProp=/*insert code here*/ 14.System.out.println(myProp); 15.} 16.} and the command line: java-Dprop.custom=gobstopper Commander Which two,placed on line13,will produce the output gobstopper?()
A. System.load("prop.custom");
B. System.getenv("prop.custom");
C. System.property("prop.custom");
D. System.getProperty("prop.custom");
E. System.getProperties().getProperty("prop.custom");
[单项选择]

下列代码中,将引起编译错误的行是()
1)public class Exercise{
2)public static void main(String args[]){
3)float f=0.0:
4)f+=1.0;
5) }
6) }


A. 第2行
B. 第3行
C. 第4行
D. 第6行
[多项选择] package com.company.application; public class MainClass{ public static void main(String[]args){} } And Main Class exists in the/apps/com/company/application directory.Assume the CLASSPATH environment variable is set to“.”(currentdirectory).Which two java commands entered at the command line will run MainClass()
A. java MainClass if run from the/apps directory
B. javacom.company.application.MainClass if run from the/apps directory
C. java-classpath/appscom.company.application.MainClass if run fro many directory
D. java-classpath.MainClass if run fromt he/apps/com/company/application directory
E. java-classpath/apps/com/company/application:.MainClass if run from the/apps directory
F. javacom.company.application.MainClassifrunfromthe/apps/com/company/application directory
[单项选择] 现有: public class Pet( ) public class Cat extends Pet{) 执行代码 Cat c- new Cat( ); Pet p= (Pet)c; 后下列哪项是正确的?()
A. Petp=(Pet)c运行错误
B. Petp=(Pet)c编译错误
C. Petp=(Pet)c止常执行
D. 以上都不对
[单项选择] package test; class Target{ public String name="hello"; } What can directly access and change the value of the variable name?()
A. any class
B. only the Target class
C. any class in the test package
D. any class that extends Target
[单项选择]阅读下面程序 public class ConcatTest {  public static void main(String[] args) {   String str1="abc";   String str2="ABC":   String str3=str1.concat(str2);   System.out.println(str3);  } } 程序运行的结果是
A. abc
B. ABC
C. abcABC
D. ABCabc
[多项选择] public class ConstOver {  public ConstOver (int x, int y, int z)  {  }  }   Which two overload the ConstOver constructor?()   
A.  ConstOver ( ) { }
B.  Protected int ConstOver ( ) { }
C.  Private ConstOver (int z, int y, byte x) { }
D.  Public Object ConstOver (int x, int y, int z) { }
E.  Public void ConstOver (byte x, byte y, byte z) { }
[单项选择] public class ArrayTest {  public static void main(String[] args) {  float fl[], f2[];  fl = new float[10];  f2 = f1;  System.out.println(“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 expectation at runtime.
[多项选择] public class Transfers {  public static void main(String[] args) throws Exception {  Record r1 = new Record();  Record r2 = new Record();  doTransfer(r1, r2, 5);  doTransfer(r2, r1, 2);  doTransfer(r1, r2, 1);  // print the result  System.out.println(”rl = “ + r1.get() +“, r2=” + r2.get());  }  private static void doTransfer(  final Record a, final Record b, final int amount) {  Thread t = new Thread() {  public void run() {  new Clerk().transfer(a, b, amount);  }  };  t.start();  }  }  class Clerk {  public synchronized void transfer(Record a, Record b, int amount){  synchronized (a) {  synchronized (b) {  a.add(-amount);  b.add(amount);  }  }  }  }  class Record {  int num=10;  public int get() { return num; }  public void add(int n) { num = num + n; }  }  If Transfers.main() is run, which three are true?()
A.  The output may be “r1 = 6, r2 = 14”.
B.  The output may be “r1 = 5, r2 = 15”.
C.  The output may be “r1 = 8, r2 = 12”.
D.  The code may run (and complete) with no output.
E.  The code may deadlock (without completing) with no output.
F.  M IllegalStateException or InterruptedException may be thrown at runtime.
[单项选择]阅读下列代码: public class Test{ public static void main(String args[]{ System.out.println(100%3); System.out.pnntln(100%3.0); } } 程序运行结果为( )。
A. 1和1
B. 1和1.0
C. 1.0各1
D. 1.0和1.0
[单项选择] public class Pass{ public static void main(String[]args){ int x=5; Pass p=new Pass(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()
A. Compilation fails.
B. An exception is thrown at runtime.
C. doStuff x=6 main x=6
D. doStuff x=5 main x=5
E. doStuff x=5 main x=6
F. doStuff x=6 main x=5
[单项选择] public class Test{ public static void main(String[]args){ intx=5; boolean b1=true; boolean b2=false; if((x==4)&&!b2) System.out.print("l"); System.out.print("2"); if((b2=true)&&b1) System.out.print("3"); } } What is the result?()
A. 2
B. 3
C. 12
D. 23
E. 123
F. Compilation fails.
G. An exceptional ist hrown at runtime.
[单项选择]阅读下面程序 public class Test2 {  public static void main(String[] args) {   int a=10,b=4.c=20,d=6;    System.out.println(a++*b+c*--d);  } } 程序运行的结果是
A. 144
B. 160
C. 140
D. 164
[单项选择]阅读下面程序 public class Test4 {  public static void main(String[] args) {   int 1=10,j=3;   float m=213.5f,n=4.0f;   System.out.println(i%j);   System.out.println(m%n);  } } 程序运行的结果是
A. 1.0和1.5
B. 1和1.5
C. 1.0和2.5
D. 1和2.5

我来回答:

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

订单号:

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