网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

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 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 CommanderB、java com.sim.sjcp.CommanderC、java com/sun/sjcp/CommanderD、java-cpcom.sun.sjcp CommanderE、java-cpcom/sun/sjcp Commander” 相关考题
考题 下列Java源程序结构中前三种语句的次序,正确的是A.import, package, public classB.import必为首,其他不限C.public class, import, packageD.package, import, public class

考题 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 CommanderB.java com.sim.sjcp.CommanderC.java com/sun/sjcp/CommanderD.java-cpcom.sun.sjcp CommanderE.java-cpcom/sun/sjcp Commander

考题 下列哪个选项的java源文件代码片段是不正确的?A.package testpackage; public class Test{ }B.import java. io. *; package testpaekage; public class Test { }C.import java.io.*; class Person { } public class Test { }D.import java.io.*; import java. awt.*; public class Test{ }

考题 下列带下画线的标识符符合Java命名约定的是A.package com.Bi.hrB.public class xyzC.intID.void setCustomerName()

考题 下列哪个选项的java源文件程序段是不正确的? ( )A.package testpackage; public class Test{ }B.import java.io.*; package testpackage; public class Test{ }C.import java.i.*; class Person{} public class Test{ }D.import java.io.*; import java.awt.*; public class Test { }

考题 有如下程序:includeusing namespace std;class C1{public:~Cl( ){cout 有如下程序: #include<iostream> using namespace std; class C1{ public: ~Cl( ){cout<<1;} }; class C2:public C1{ public: ~C2( ){cout<<2;} }; int main( ){ C2 cb2; C1*cb1: return 0; } 程序的输出结果是A.121B.21C.211D.12

考题 下列带下画线的标识符,符合Java命名约定的是 A) B)C) D)A.package com.Bi.hrB.public class xyzC.int ID.void setCustomerName()

考题 IPAC是以下哪个词组的缩略语()A、Internet Public Access CatalogB、Internal Public Access CatalogC、Internet Package Access CatalogD、Internet Public Available Catalog

考题 Which will declare a method that is available to all members of the same package and can be referenced  without an instance of the class?()  A、 Abstract public void methoda();B、 Public abstract double methoda();C、 Static void methoda(double d1){}D、 Public native double methoda(){}E、 Protected void methoda(double d1){}

考题 Which will declare a method that is available to all members of the same package and be referenced without an instance of the class?()A、 abstract public void methoda ();B、 public abstract double inethoda ();C、 static void methoda (double dl) {}D、 public native double methoda () {}E、 protected void methoda (double dl) {}

考题 package test1;  public class Test1 {  static int x = 42;  }  package test2;  public class Test2 extends test1.Test1 {  public static void main(String[] args) { System.out.println(“x = “ + x);  }  }  What is the result?() A、 x = 0B、 x = 42C、 Compilation fails because of an error in line 2 of class Test2.D、 Compilation fails because of an error in line 3 of class Test1.E、 Compilation fails because of an error in line 4 of class Test2.

考题 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()”

考题 package geometry;  public class Hypotenuse {  public InnerTriangle it = new InnerTriangle();  class InnerTriangle {  public int base;  public int height;  }  }  Which is true about the class of an object that can reference the variable base? ()A、 It can be any class.B、 No class has access to base.C、 The class must belong to the geometry package.D、 The class must be a subclass of the class Hypotenuse.

考题 It is desirable that a certain method within a certain class can only be accessed by classes that are defined within the same package as the class of the method. How can such restrictions be enforced?()  A、Mark the method with the keyword public.B、Mark the method with the keyword protected.C、Mark the method with the keyword private.D、Mark the method with the keyword package.E、Do not mark the method with any accessibility modifiers.

考题 Given a correctly compiled class whose source code is:  package com.sun.sjcp;  public class Commander {  public static void main(String[] args) {  // more code here  }  }  Assume that the class file is 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 CommanderB、 java com. sim. sjcp.CommanderC、 java com/sun/sjcp/CommanderD、 java -cp com.sun.sjcp CommanderE、 java -cp com/sun/sjcp Commander

考题 单选题It is desirable that a certain method within a certain class can only be accessed by classes that are defined within the same package as the class of the method. How can such restrictions be enforced?()A Mark the method with the keyword public.B Mark the method with the keyword protected.C Mark the method with the keyword private.D Mark the method with the keyword package.E Do not mark the method with any accessibility modifiers.

考题 单选题package geometry;  public class Hypotenuse {  public InnerTriangle it = new InnerTriangle();  class InnerTriangle {  public int base;  public int height;  }  }  Which is true about the class of an object that can reference the variable base? ()A  It can be any class.B  No class has access to base.C  The class must belong to the geometry package.D  The class must be a subclass of the class Hypotenuse.

考题 单选题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 CommanderB java com.sim.sjcp.CommanderC java com/sun/sjcp/CommanderD java-cpcom.sun.sjcp CommanderE java-cpcom/sun/sjcp Commander

考题 单选题Given classes defined in two different files:  1. package util;  2. public class BitUtils {  3. public static void process(byte[]) { /* more code here */ }  4. }  1. package app;  2. public class SomeApp {  3. public static void main(String[] args) {  4. byte[] bytes = new byte[256];  5. // insert code here  6. }  7. }  What is required at line 5 in class SomeApp to use the process method of BitUtils?()A  process(bytes);B  BitUtils.process(bytes);C  util.BitUtils.process(bytes);D  SomeApp cannot use methods in BitUtils.E  import util.BitUtils.*; process(bytes);

考题 单选题下列Java源程序结构中前三种语句的次序,正确的是(  )。A import,package,public classB import必为首,其他不限C public class,package,importD package,import,public class

考题 单选题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()”

考题 单选题package test1;  public class Test1 {  static int x = 42;  }  package test2;  public class Test2 extends test1.Test1 {  public static void main(String[] args) { System.out.println(“x = “ + x);  }  }  What is the result?()A  x = 0B  x = 42C  Compilation fails because of an error in line 2 of class Test2.D  Compilation fails because of an error in line 3 of class Test1.E  Compilation fails because of an error in line 4 of class Test2.

考题 单选题package test; class Target{ public String name="hello"; } What can directly access and change the value of the variable name?()A any classB only the Target classC any class in the test packageD any class that extends Target

考题 单选题Which will declare a method that is available to all members of the same package and can be referenced without an instance of the class?()A  Abstract public void methoda();B  Public abstract double methoda();C  Static void methoda(double d1){}D  Public native double methoda()  {}E  Protected void methoda(double d1)  {}

考题 单选题Which will declare a method that is available to all members of the same package and be referenced without an instance of the class?()A  abstract public void methoda ();B  public abstract double inethoda ();C  static void methoda (double dl) {}D  public native double methoda () {}E  protected void methoda (double dl) {}

考题 单选题package foo;  public class Outer {  public static class Inner {  }  }   Which statement is true?()A  Compilation fails.B  An instance of the Inner class can be constructed with “new Outer.Inner()”.C  An instance of the Inner class cannot be constructed outside of package foo.D  An instance of the Inner class can be constructed only from within the Outer class.E  From within the package foo, and instance of the Inner class can be constructed with “new Inner()”.

考题 单选题Given a correctly compiled class whose source code is:  package com.sun.sjcp;  public class Commander {  public static void main(String[] args) {  // more code here  }  }  Assume that the class file is 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 CommanderB  java com. sim. sjcp.CommanderC  java com/sun/sjcp/CommanderD  java -cp com.sun.sjcp CommanderE  java -cp com/sun/sjcp Commander

考题 单选题ClassOne.java   package com.abc.pkg1;   public class ClassOne {   private char var = ‘a‘;   char getVar() {return var;}   }   ClassTest.java   package com.abc.pkg2;   import com.abc.pkg1.ClassOne;   public class ClassTest extends ClassOne {  public static void main(Stringargs) {  char a = new ClassOne().getVar();  char b = new ClassTest().getVar();   }   }   What is the result?()A  Compilation will fail.B  Compilation succeeds and no exceptions are thrown.C  Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.D  Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.