多选题定义如下的二维数组b,下面的说法正确的是( )。 int b[][]=1, 2, 3, 4, 5,6, 7, 8; A.b.length的值是3。 B.b[1].length的值是3。 C.b[1][1]的值是5。 D.二维数组b的第一行有3个元素
多选题The for loop has been enhanced in Java 5.0. Which is not a common term
for the improved for loop?
A. The for in loop
B. The specialized for loop
C. The for each loop
D. The enhanced for loop
多选题Which two import statements will allow for the import of the HashMap
class?
A. import java.util.HashMap;
B. import java.util.*;
C. import java.util.HashMap.*;
D. import java.util.hashMap;
多选题What is the effect of the following line of code?
super()
A. The method that is overridden by the current method is called.
B. The parent class's constructor is called.
C. The current class's constructor is called.
D. The child class's constructor is called
E. The current method is recursively called.
多选题Given the SampleClass, what is the output of this code
segment? SampleClass s = new SampleClass();
s.sampleMethod(4.4, 4); public class SampleClass {
public void sampleMethod(int a, double b) {
System.out.println("Method 1"); } public void
sampleMethod(double b, int a) { System.out.println("Method
2"); } }
A. Method 1
B. Method 2
C. Method 1 Method 2
D. Method 2 Method 1
E. Compiler error
多选题Given:
String name1 = new String("Benjamin");
StringBuilder name2 = new StringBuilder("Benjamin");
System.out.println(name2.equals(name1));
Are the String and StringBuilder classes of comparable types? Select the correct statement.
A. The String and StringBuilder classes are comparable types.
B. The String and StringBuilder classes are incomparable types.
多选题Considerthefollowingillustration.Whatproblemexistswiththepackaging?YoumaywishtoreferenceAppendixGontheUnifiedModelingLanguage(UML)forassistance.A.Youcanhaveonlyoneclassperpackage.B.Packagescannothaveassociationsbetweenthem.C.Packagecom.ocajexam.backing_beansfailstomeettheappropriatepackagingnamingconventions.D.PackageCOM.OCAJEXAM.UTILSfailstomeettheappropriatepackagingnamingconventions.
多选题What is the output of the following code segment?
String[] numbers = {"One", "Two", "Three"};
System.out.println(numbers[3]+" "+numbers[2]+" "+ numbers[1]);
A. One Two Three
B. Three Two One
C. A compile time error will be generated.
D. A runtime exception will be thrown.
多选题下面哪些关键字能用来控制对类成员的访问( )? A.public B.protected C.private D.default
多选题Given the following line of code, which of the lines of code listed
are incorrect? (Choose all that apply.) char c;
A. c = new char();
B. c = 'Y';
C. c = '/u0056';
D. c = "Yes";
多选题The following code segment is valid. True or false?
int[][] square = new int[2][];
square[0] = new int[5];
square[1]=new int[3];
A. True
B. False
多选题Which keyword is part of a transfer of control statement?
A. if
B. return
C. do
D. assert
多选题The ArrayList class is part of what Java package?
A. java.lang
B. java.util
C. javax.tools
D. javax.swing
多选题下面关于外部类和内部类成员的相互访问的规则中,正确的选项是( )。 A.内部类可以直接访问外部类的成员 B.外部类可以直接访问内部类的成员 C.外部类不能访问内部类的成员 D.外部类可通过创建内部类的实例来访问内部类的成员
多选题线程对象的生命周期中,通常经历下面哪些状态( )。 A.新建 B.运行 C.就绪 D.死亡
多选题What is the output of the following code segment?
int[] testScores = {80,63,99,87,100};
System.out.println("Length: " + testScores.length);
A. Length: 4
B. Length: 5
C. Length: 100
D. A compile time error will be generated.
E. A runtime exception will be thrown.
多选题TheDrivableinterface:publicinterfaceDrivable{/**Drivabledefinitions*/}TheTractorclass:publicclassTractorimplementsDrivable{/**Tractorfunctionality*/}TheVehicleclass:publicclassVehicle{/**Vehiclefunctionality*/}TheCarclass:publicclassCarextendsVehicleimplementsDrivable{/**Carfunctionality*/}TheTruckclass:publicclassTruckextendsVehicleimplementsDrivable{/**Truckfunctionality*/}UMLforquestions
多选题Given x is declared with a valid integer, which conditional statement
will not compile?
A. if(x == 0) {System.out.println("True Statement");}
B. if(x == 0) {System.out.println("False Statement");}
C. if(x == 0) {;} elseif(x == 1){System.out.println("Valid
Statement");}
D. if(x == 0); else if(x == 1){} else {;}
多选题A switch statement works with which wrapper class/reference type(s)?
A. Character
B. Byte
C. Short
D. Int
多选题Which of the following variables are being set with the use of a
literal? (Choose all that apply.)
A. int tvChannel = 4;
B. char c = '5';
C. chard = '/u0123';
D. char e = c;
E. int oldChannel = tvChannel;
