多选题package com.company.application; public class MainClass { public static void main(String[] args) { } } And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to “.“ (current directory). Which two java commands entered at the command line will run MainClass?()Ajava MainClass if run from the /apps directoryBjava com.company.application.MainClass if run from the /apps directoryCjava -classpath /apps com.company.application.MainClass if run from any directoryDjava -classpath . MainClass if run from the /apps/com/company/application directoryEjava -classpath /apps/com/company/application:. MainClass if run from the /apps directoryFjava com.company.application.MainClass if run from the /apps/com/company/application directory
多选题
package com.company.application; public class MainClass { public static void main(String[] args) { } } And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to “.“ (current directory). Which two java commands entered at the command line will run MainClass?()
A
java MainClass if run from the /apps directory
B
java com.company.application.MainClass if run from the /apps directory
C
java -classpath /apps com.company.application.MainClass if run from any directory
D
java -classpath . MainClass if run from the /apps/com/company/application directory
E
java -classpath /apps/com/company/application:. MainClass if run from the /apps directory
F
java com.company.application.MainClass if run from the /apps/com/company/application directory
参考解析
解析:
暂无解析
相关考题:
下列Java源程序结构中前三种语句的次序,正确的是A.import, package, public classB.import必为首,其他不限C.public class, import, packageD.package, import, public class
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
如下两个源程序文件,分别编译后,运行Example.class文件,运行结果为______。AB.java文件代码如下;package test;public class AB{int a=60;public void show(){System.out.println(”a=”+a);}Example.java文件代码如下:import test.AB;class Example{public static void main(String args[]){AB bj=new AB();obj.show();}}
下列哪个选项的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 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 { }
以下语句能顺利通过编译: abstract class class1 { } public class mainClass { public static void main(String args[]) { class1 cs1=new class1(); } } 。() 此题为判断题(对,错)。
设有程序如下: abstract class absclass { abstract void method1(); } class conclass extends absclass { public void method1() { System.out.println("子类");} } public class mainclass { public static void main(String args[]) { absclass ac1=new absclass(); //语句1 absclass ac2=new conclass(); //语句2 ac2.method1(); //语句3 } } 则main()方法中的第一条语句(即语句1)可以顺利通过编译。()此题为判断题(对,错)。
给出下列java源代码: //Point x Public class Interesting{} 在源代码//point x处添加()能符合java语法 A、import java.awt.*B、package local.utilC、class MoreInteresting{}D、protected class MoreInteresting{}
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.
在单一文件中import、class和package的正确出现顺序是()A、package,import,classB、class,import,packageC、import,package,classD、package,class,import
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.
多选题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()Ajava MainClass if run from the/apps directoryBjavacom.company.application.MainClass if run from the/apps directoryCjava-classpath/appscom.company.application.MainClass if run fro many directoryDjava-classpath.MainClass if run fromt he/apps/com/company/application directoryEjava-classpath/apps/com/company/application:.MainClass if run from the/apps directoryFjavacom.company.application.MainClassifrunfromthe/apps/com/company/application directory
单选题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?()AMark the method with the keyword public.BMark the method with the keyword protected.CMark the method with the keyword private.DMark the method with the keyword package.EDo not mark the method with any accessibility modifiers.
单选题Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()Aany classBonly the Target classCany class in the test packageDany class that extends Target
单选题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.
单选题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);
单选题Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()Aany classBonly the Target classCany class in the test packageDany class that extends Target
单选题下列Java源程序结构中前三种语句的次序,正确的是( )。Aimport,package,public classBimport必为首,其他不限Cpublic class,package,importDpackage,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?()Aany classBonly the Target classCany class in the test packageDany class that extends Target
单选题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()”.
多选题package com.company.application; public class MainClass { public static void main(String[] args) { } } And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to “.“ (current directory). Which two java commands entered at the command line will run MainClass?()Ajava MainClass if run from the /apps directoryBjava com.company.application.MainClass if run from the /apps directoryCjava -classpath /apps com.company.application.MainClass if run from any directoryDjava -classpath . MainClass if run from the /apps/com/company/application directoryEjava -classpath /apps/com/company/application:. MainClass if run from the /apps directoryFjava com.company.application.MainClass if run from the /apps/com/company/application directory
单选题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