Question: Part A: class Identifiers { int i1; // 1 int _i2; // 2 int i_3; // 3 int #i4; // 4 int $i5; // 5
Part A:
class Identifiers {
int i1; // 1
int _i2; // 2
int i_3; // 3
int #i4; // 4
int $i5; // 5
int %i6; // 6
int i$7; // 7
int 8i; // 8
}
Compile-time errors are generated at which lines? Choose 3.
a. 1
b. 2
c. 3
d. 4
e. 5
f. 6
g. 7
h. 8
Part B:
Entries are organized as key/value pairs.
Duplicate entries replace old entries.
Which interface of the java.util package offers the specified behavior?
a. List
b. Map
c. Set
d. None of the above
Part C:
1 import java.util.*;
2 class A {
3 public static void main (String args[]) {
4 Object a = new HashSet();
5 System.out.print((a instanceof Set)+",");
6 System.out.print(a instanceof SortedSet);
7 }
8 }
What is the result of attempting to compile and run the program?
a. Prints: false,false
b. Prints: false,true
c. Prints: true,false
d. Prints: true,true
e. None of the above
Part D:
If you attempt to compile and execute the application listed below, will it ever print out the message In xxx?
1. class TestThread3 extends Thread {
2. public void run() {
3. System.out.println("Running");
4. System.out.println("Done");
5. }
6.
7. private void xxx() {
8. System.out.println("In xxx");
9. }
10.
11. public static void main(String args[]) {
12. TestThread3 ttt = new TestThread3();
13. ttt.xxx();
14. ttt.start(); 12. }
13. }
a. Yes
b. No
Part E:
What does the following code print out?
1. try {
2. int i = -5 % -3;
3. System.out.println("i = " + i);
4. }
5. catch (Exception e) {
6. System.out.println("TROUBLE");
7. }
a. i = 2
b. i = 3
c. i = -2
d. i = -3
e. TROUBLE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
