多选题下面关于Java中异常处理try块的说法正确的是______? A.try块后通常应有一个catch 块,用来处理try块中抛出的异常。 B.catch 块后必须有finally块。 C.可能抛出异常的方法调用应放在try块中。 D.对抛出的异常的处理必须放在try块中
多选题A method needs to be created that accepts an array of floats as an
argument and does not return any variables. The method should be called
setPoints. Which of the following method declarations is correct?
A. setPoints(float[] points) {...}
B. void setPoints(float points) {...}
C. void setPoints(float[] points) {...}
D. float setPoints(float[] points) {...}
多选题Which of the following is the only Java package that is imported by
default?
A. java.awt
B. java.lang
C. java.util
D. java.io
多选题类B是一个抽象类,类C是类B的非抽象子类,下列创建对象x1的语句中正确的是( )。 A.B x1= new B( ); B.B x1= new C( ); C.C x1=new C( ); D.C x1= new B( );
多选题Considerthefollowingillustration.Whichstatements,alsorepresentedintheillustration,aretrue?A.TheStringclassimplementstheObjectinterface.B.TheStringclassimplementstheComparable,Serializable,andCharSequenceinterfaces.C.ThetoStringmethodoverridesthetoStringmethodoftheObjectclass,allowingtheStringobjecttoreturnitsownstring.D.ThetoStringmethodispubliclyaccessible.
多选题You need to create a class to store information about books contained
in a library. What variable scope is best suited for the variable that will
store the title of a book?
A. Local variable
B. Static variable
C. Global variable
D. Method parameter
E. Instance variable
多选题Given the SampleClass, what is the output of this code
segment? SampleClass sampleClass = new SampleClass();
public class SampleClass { private int size;
public SampleClass() { this(1);
System.out.println("Using default values"); }
public SampleClass(int size) { this.size = size;
System.out.println("Setting size"); } }
A. Using default values
B. Setting size
C. Using default values Setting size
D. Setting size Using default values
E. Compiler error
多选题Which statement would designate that your file belongs in the package
com. ocajexam.utilities?
A. pack com.ocajexam.utilities;
B. Package com.ocajexam.utilities.*
C. package com.ocajexam.utilities.*;
D. package com.ocajexam.utilities;
多选题下面关于进程、线程的说法正确的是______。 A.进程是程序的一次动态执行过程。一个进程在其执行过程中,可以产生多个线程——多线程,形成多条执行线索。 B.线程是比进程更小的执行单位,是在一个进程中独立的控制流,即程序内部的控制流。线程本身不能自动运行,栖身于某个进程之中,由进程启动执行。 C.Java多线程的运行与平台相关。 D.对于单处理器系统,多个线程分时间片获取CPU或其他系统资源来运行。对于多处理器系统,线程可以分配到多个处理器中,从而真正的并发执行多任务。
多选题What line will produce a compiler error?
A. double[][] numbers;
B. double[][][] numbers;
C. double[][] numbers = {{1,2,3},{7,8,9},{4,5,6}};
D. double[][] numbers = {{1,2,3},{7,8},{4,5,6,9}};
E. double[][][] numbers = new double[7][][];
F. double[][][] numbers = new double[][][];
G. double[][][] numbers = new double[7][3][2];
多选题Given: String tenCharString = "AAAAAAAAAA";
System.out.println(tenCharString.replace("AAA", "LLL"));
What is printed to the standard out?
A. AAAAAAAAAA
B. LLLAAAAAAA
C. LLLLLLLLLA
D. LLLLLLLLLL
多选题Given the SampleClass, what is the output of this code
segment? SampleClass s = new SampleClass();
SampleClass.sampleMethodOne(); public class SampleClass
{ public static void sampleMethodOne() {
sampleMethodTwo();
System.out.println("sampleMethodOne"); }
public void sampleMethodTwo() {
System.out.println("sampleMethodTwo"); } }
A. sampleMethodOne
B. sampleMethodTwo
C. sampleMethodOne sampleMethodTwo
D. sampleMethodTwo sampleMethodOne
E. Compiler error
多选题What is the value of the size variable at the completion of this code
segment? ArrayList <Object> sampleArrayList = new ArrayList
<Object>(); sampleArrayList.add(new Object());
sampleArrayList.ensureCapacity(15); sampleArrayList.add(new
Object()); int size = sampleArrayList.size();
A. 0
B. 1
C. 2
D. 10
E. 15
F. A compile time error will be generated.
G. A runtime exception will be thrown.
多选题Which is not a type of statement?
A. Conditional statement
B. Assignment statement
C. Iteration statement
D. Propagation statement
多选题What is the correct way to create an array with five int data types?
(Choose all that apply.)
A. int intArray = new int[5];
B. int intArray = new int(5);
C. int[] intArray = new int[5];
D. int intArray[] = new int [5];
多选题Which two command-line invocations of the Java interpreter return the
version of the interpreter?
A. java -version
B. java --version
C. java -version ProgramName
D. java ProgramName -version
多选题What is the output of the following code segment?
Integer[] integerArray1 = {new Integer(100), new Integer(1), new Integer(30), new Integer (50)};
Integer[] integerArray2 = new Integer[2];
integerArray2[0] = new Integer(100);
System.arraycopy(integerArray1, 2, integerArray2, 1, 1);
for(Integer i : integerArray2) {
System.out.print(i+" ");
}
A. 100 1 30 50
B. 100 1
C. 100 30
D. 100 1 30
E. 600 1
F. 600 30
G. 600 1 30
H. A compile time error will be generated.
I. A runtime exception will be thrown.
多选题Which indexOf method declaration is invalid?
A. indexOf(int ch)
B. indexOf(int ch, int fromlndex)
C. indexOf(String str, int fromlndex)
D. indexOf(CharSequence str, int fromlndex)
多选题The JCheckBox and JComboBox classes belong to which package?
A. java.awt
B. javax.awt
C. java.swing
D. javax.swing
多选题What is the output of the following code segment?
String[] numbers = {"One" "'Two", "Three"}; for(String s :
numbers){ System.out.print(s+" "); }
A. One Two Three
B. Three Two One
C. A compile time error will be generated.
D. A runtime exception will be thrown.