float f[][][] = new float[3][][];
float f0 = 1.0f;
float[][] farray = new float[1][1];
What is valid?()
A. f[0] = f0;
B. f[0] = farray;
C. f[0] = farray[0];
D. f[0] = farray[0][0];
您可能感兴趣的试卷
你可能感兴趣的试题
int x = 1, y =6;
while (y--) {
x++;
}
System.out.println(“x =” + x + “y =” +y);
What is the result?()
A. x = 6 y = 0
B. x = 7 y = 0
C. x = 6 y = -1
D. x = 7 y = -1
E. Compilation fails.
A. x.delete()
B. x.finalize()
C. Runtime.getRuntime().gc()
D. Explicitly setting the object’s reference to null.
E. Ensuring there are no references to the object.
F. Only the garbage collection system can destroy an object.
1. public class Outer{
2. public void someOuterMethod() {
3. // Line 3
4. }
5. public class Inner{}
6. public static void main( String[]argv ) {
7. Outer o = new Outer();
8. // Line 8
9. }
10. }
Which instantiates an instance of Inner?()
A. new Inner(); // At line 3
B. new Inner(); // At line 8
C. new o.Inner(); // At line 8
D. new Outer.Inner(); // At line 8
1. public class ReturnIt {
2. return Type methodA(byte x, double y) {
3. return (short)x / y * 2;
4. }
5. }
What is the narrowest valid returnType for methodA in line2?()
A. int
B. byte
C. long
D. short
E. float
F. double
A. class A{}
B. class A { public A(){} }
C. class A { public A(int x){} }
D. class Z {} class A extends Z { void A(){} }
11. public class Test {
12. public void foo() {
13. assert false;
14. assert false;
15. }
16. public void bar(){
17. while(true){
18. assert false;
19. }
20. assert false;
21. }
22. }
What causes compilation to fail?()
A. Line 13
B. Line 14
C. Line 18
D. Line 20
interface Beta {}
class Alpha implements Beta {
String testIt() {
return “Tested”;
}
}
public class Main1 {
static Beta getIt() {
return new Alpha();
}
public static void main( String[] args ) {
Beta b = getIt();
System.out.println( b.testIt() );
}
}
What is the result?()
A. Tested
B. Compilation fails.
C. The code runs with no output.
D. An exception is thrown at runtime.
1. class Bar { }
1. class Test {
2. Bar doBar() {
3. Bar b = new Bar();
4. return b;
5. }
6. public static void main (String args[]) {
7. Test t = new Test();
8. Bar newBar = t.doBar();
9. System.out.println(“newBar”);
10. newBar = new Bar();
11. System.out.println(“finishing”);
12. }
13. }
At what point is the Bar object, created on line 3, eligible for garbage collection?()
A. After line 8.
B. After line 10.
C. After line 4, when doBar() completes.
D. After line 11, when main() completes.
1. public class A {
2. void A() {
3. System.out.println(“Class A”);
4. }
5. public static void main(String[] args) {
6. new A();
7. }
8. }
What is the result?()
A. Class A
B. Compilation fails.
C. An exception is thrown at line 2.
D. An exception is thrown at line 6.
E. The code executes with no output.
20. public float getSalary(Employee e) {
21. assert validEmployee(e);
22. float sal = lookupSalary(e);
23. assert (sal>0);
24. return sal;
25. }
26. private int getAge(Employee e) {
27. assert validEmployee(e);
28. int age = lookupAge(e);
29. assert (age>0);
30. return age;
31. }
Which line is a violation of appropriate use of the assertion mechanism?()
A. line 21
B. line 23
C. line 27
D. line 29
最新试题
Which two statements are true?()
Which statement is true?()
Which statement is true?()
What is the result?()
Which two can be results?()
Which statement is true?()
Which three will compile and run without exception?()
What is the result?()
Which two of statements are true?()
Given that Triangle implements Runnable, and:Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads to temporarily pause and allow the other thread to execute?()