Given:
public class Test {
static boolean bVar;
public static void main(String[] args) {
boolean bVar1 = true;
int count =8;
do {
System.out.println("Hello Java! " +count);
if (count >= 7) {
bVar1 = false;
}
} while (bVar != bVar1 andand count > 4);
count -= 2;
}
}
What is the result?
A. Hello Java! 8 Hello Java! 6 Hello Java! 4
B. Hello Java! 8 Hello Java! 6
C. Hello Java! 8
D. Compilation fails
Given: Which constructor initializes the variable x3?
A. Only the default constructor of class X
B. Only the no-argument constructor of class Y
C. Only the no-argument constructor of class Z
D. Only the default constructor of object class
Given the code fragment:
Which modification enables the code to print 54321?
A. Replace line 6 with System, out. print (--x) ;
B. At line 7, insert x --;
C. Replace line 6 with --x; and, at line 7, insert system, out. print (x);
D. Replace line 12 With return (x > 0) ? false: true;
Given the following class:
And given the following main method, located in another class:
Which three lines, when inserted independently at line n1, cause the program to print a o balance?
A. this.amount = 0;
B. acct.setAmount(0);
C. acct (0) ;
D. acct.amount = 0;
E. acct. getAmount () = 0;
F. acct.changeAmount(0);
G. acct.changeAmount(-acct.amount);
H. acct.changeAmount(-acct.getAmount());
Given the code fragments:
And,
Which statement is true?
A. After line 11, three objects are eligible for garbage collection.
B. After line 11, two objects are eligible for garbage collection.
C. After line 11, one object is eligible for garbage collection.
D. After line 11, none of the objects are eligible for garbage collection.
Which two array initialization statements are valid? (Choose two.)
A. int array[] = new int[3] {1, 2, 3};
B. int array[] = new int[3]; array[0] = 1; array[1] = 2; array[2] = 3;
C. int array[3] = new int[] {1, 2, 3};
D. int array[] = new int[3]; array = {1, 2, 3};
E. int array[] = new int[] {1,2,3};
Given:
What is the result?
A. Vehicle Bus
B. Bus Vehicle
C. Bus
D. The program doesn't print anything
Which two code fragments cause compilation errors? (Choose two.)
A. double y1 = 203.22; float fit = y1;
B. float fit = (float) 1_11.00;
C. Float fit = 100.00;
D. int y2 = 100; float fit = (float) y2;
E. float fit = 100.00F;