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?()
第1题:
下列哪个选项的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 { }
第2题:
下列带下画线的标识符,符合Java命名约定的是 A) B)
C) D)
A.package com.Bi.hr
B.public class xyz
C.int I
D.void setCustomerName()
第3题:
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?()
第4题:
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?()
第5题:
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? ()
第6题:
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?()
第7题:
It can be any class.
No class has access to base.
The class must belong to the geometry package.
The class must be a subclass of the class Hypotenuse.
第8题:
process(bytes);
BitUtils.process(bytes);
util.BitUtils.process(bytes);
SomeApp cannot use methods in BitUtils.
import util.BitUtils.*; process(bytes);
第9题:
An instance of the Inner class can be constructed with “new Outer.Inner ()”
An instance of the inner class cannot be constructed outside of package foo.
An instance of the inner class can only be constructed from within the outer class.
From within the package bar, an instance of the inner class can be constructed with “new inner()”
第10题:
any class
only the Target class
any class in the test package
any class that extends Target
第11题:
abstract public void methoda ();
public abstract double inethoda ();
static void methoda (double dl) {}
public native double methoda () {}
protected void methoda (double dl) {}
第12题:
java Commander
java com. sim. sjcp.Commander
java com/sun/sjcp/Commander
java -cp com.sun.sjcp Commander
java -cp com/sun/sjcp Commander
第13题:
有如下程序: #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.121
B.21
C.211
D.12
第14题:
IPAC是以下哪个词组的缩略语()
第15题:
Which will declare a method that is available to all members of the same package and be referenced without an instance of the class?()
第16题:
package foo; public class Outer ( public static class Inner ( ) ) Which statement is true? ()
第17题:
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?()
第18题:
Mark the method with the keyword public.
Mark the method with the keyword protected.
Mark the method with the keyword private.
Mark the method with the keyword package.
Do not mark the method with any accessibility modifiers.
第19题:
java Commander
java com.sim.sjcp.Commander
java com/sun/sjcp/Commander
java-cpcom.sun.sjcp Commander
java-cpcom/sun/sjcp Commander
第20题:
import,package,public class
import必为首,其他不限
public class,package,import
package,import,public class
第21题:
x = 0
x = 42
Compilation fails because of an error in line 2 of class Test2.
Compilation fails because of an error in line 3 of class Test1.
Compilation fails because of an error in line 4 of class Test2.
第22题:
Abstract public void methoda();
Public abstract double methoda();
Static void methoda(double d1){}
Public native double methoda() {}
Protected void methoda(double d1) {}
第23题:
Compilation fails.
An instance of the Inner class can be constructed with “new Outer.Inner()”.
An instance of the Inner class cannot be constructed outside of package foo.
An instance of the Inner class can be constructed only from within the Outer class.
From within the package foo, and instance of the Inner class can be constructed with “new Inner()”.
第24题:
Compilation will fail.
Compilation succeeds and no exceptions are thrown.
Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.