Given:
1. public abstract class Wow {
2. private int wow;
3. public Wow(int wow) {
4. this.wow = wow;
5. }
6. public void wow() { }
7. private void wowza() { }
8. }
Which is true about the class Wow?
Given:
1. class X {
2. private Y y;
3. public X(Y y) { this.y = y; }
4. }
5. class Y {
6. private X x;
7. public Y() { }
8. public Y(X x) { this.x = x; }
9. }
The instance variable y is intended to represent the composition relationship "X is composed of Y."
Which code correctly maintains this meaning?
Given:
4. class Example {
5. int x = 50;
6. int y = 100;
7. public static void main(String args[]) {
8. int x = 0, y = 10;
9. Example ex = new Example();
10. while (x < 3) {
11. x++; y--;
12. }
13. System.out.println("x = " + x + " , y = " + y);
14. }
15. }
What is the result?
You have developed a MIDlet that runs on a Java-enabled Personal Digital Assistant (PDA) device. Now, your employer has asked you to port the MIDlet to run on
other Java platforms. Which is true?
Given:
12. String s = "abcdefgabc";
13. char c = s.charAt(2);
14.
15. if (c == 'c')
16. s = s.replace('c', 'X');
17. else if (c == 'b')
18. s = s.replace('b', 'O');
19. else
20. s = s.replace('c', 'O');
21. System.out.println(s);
What is the result?