Oracle Java Standard Edition 5 Programmer Certified Professional - 1Z0-853무료 덤프문제 풀어보기
Given:
1.class Super {
2.private int a;
3.protected Super(int a) { this.a = a; }
4.} ...
11.
class Sub extends Super {
12.
public Sub(int a) { super(a); }
13.
public Sub() { this.a = 5; }
14.
}
Which two, independently, will allow Sub to compile? (Choose two.)
1.class Super {
2.private int a;
3.protected Super(int a) { this.a = a; }
4.} ...
11.
class Sub extends Super {
12.
public Sub(int a) { super(a); }
13.
public Sub() { this.a = 5; }
14.
}
Which two, independently, will allow Sub to compile? (Choose two.)
정답: B,C
Which two statements are true about the hashCode method? (Choose two.)
정답: C,E
Given:
1.public class MyLogger {
2.private StringBuilder logger = new StringBuuilder();
3.public void log(String message, String user) {
4.logger.append(message);
5.logger.append(user);
6.}
7.}
The programmer must guarantee that a single MyLogger object works properly for a multi
threaded system.
How must this code be changed to be thread-safe?
1.public class MyLogger {
2.private StringBuilder logger = new StringBuuilder();
3.public void log(String message, String user) {
4.logger.append(message);
5.logger.append(user);
6.}
7.}
The programmer must guarantee that a single MyLogger object works properly for a multi
threaded system.
How must this code be changed to be thread-safe?
정답: B
Given:
1.public class Target {
2.private int i = 0;
3.public int addOne(){
4.return ++i;
5.}
6.} And:
1.public class Client {
2.public static void main(String[] args){
3.System.out.println(new Target().addOne());
4.}
5.}
Which change can you make to Target without affecting Client?
1.public class Target {
2.private int i = 0;
3.public int addOne(){
4.return ++i;
5.}
6.} And:
1.public class Client {
2.public static void main(String[] args){
3.System.out.println(new Target().addOne());
4.}
5.}
Which change can you make to Target without affecting Client?
정답: C
Click the Exhibit button. What is the result?


정답: A
Given:
11.
abstract class Vehicle { public int speed() { return 0; }
12.
class Car extends Vehicle { public int speed() { return 60; }
13.
class RaceCar extends Car { public int speed() { return 150; } ...
21.
RaceCar racer = new RaceCar();
22.
Car car = new RaceCar();
23.
Vehicle vehicle = new RaceCar();
24.
System.out.println(racer.speed() + ", " + car.speed()
25.
+ ", " + vehicle.speed());
What is the result?
11.
abstract class Vehicle { public int speed() { return 0; }
12.
class Car extends Vehicle { public int speed() { return 60; }
13.
class RaceCar extends Car { public int speed() { return 150; } ...
21.
RaceCar racer = new RaceCar();
22.
Car car = new RaceCar();
23.
Vehicle vehicle = new RaceCar();
24.
System.out.println(racer.speed() + ", " + car.speed()
25.
+ ", " + vehicle.speed());
What is the result?
정답: A
Given:
1.public class Blip {
2.protected int blipvert(int x) { return 0; }
3.}
4.class Vert extends Blip {
5.// insert code here
6.}
Which five methods, inserted independently at line 5, will compile? (Choose five.)
1.public class Blip {
2.protected int blipvert(int x) { return 0; }
3.}
4.class Vert extends Blip {
5.// insert code here
6.}
Which five methods, inserted independently at line 5, will compile? (Choose five.)
정답: A,C,D,E,F
Given:
1.import java.util.*;
2.public class Example {
3.public static void main(String[] args) {
4.// insert code here
5.set.add(new Integer(2));
6.set.add(new Integer(1));
7.System.out.println(set);
8.}
9.}
Which code, inserted at line 4, guarantees that this program will output [1, 2]?
1.import java.util.*;
2.public class Example {
3.public static void main(String[] args) {
4.// insert code here
5.set.add(new Integer(2));
6.set.add(new Integer(1));
7.System.out.println(set);
8.}
9.}
Which code, inserted at line 4, guarantees that this program will output [1, 2]?
정답: A
DRAG DROP
Click the Task button.

Click the Task button.

정답:

Given:
15.
public class Yippee {
16.
public static void main(String [] args) {
17.
for(int x = 1; x < args.length; x++) {
18.
System.out.print(args[x] + " ");
19.
}
20.
}
21.
}
and two separate command line invocations:
java Yippee java Yippee 1 2 3 4
What is the result?
15.
public class Yippee {
16.
public static void main(String [] args) {
17.
for(int x = 1; x < args.length; x++) {
18.
System.out.print(args[x] + " ");
19.
}
20.
}
21.
}
and two separate command line invocations:
java Yippee java Yippee 1 2 3 4
What is the result?
정답: C
Given a correctly compiled class whose source code is:
1.package com.sun.sjcp;
2.public class Commander {
3.public static void main(String[] args) {
4.// more code here
5.}
6.}
Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that the classpath contains "." (current directory).
Which command line correctly runs Commander?
1.package com.sun.sjcp;
2.public class Commander {
3.public static void main(String[] args) {
4.// more code here
5.}
6.}
Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that the classpath contains "." (current directory).
Which command line correctly runs Commander?
정답: C
Given:
10.
class One {
11.
void foo() { }
12.
}
13.
class Two extends One {
14.
//insert method here
15.
}
Which three methods, inserted individually at line 14, will correctly complete class Two? (Choose three.)
10.
class One {
11.
void foo() { }
12.
}
13.
class Two extends One {
14.
//insert method here
15.
}
Which three methods, inserted individually at line 14, will correctly complete class Two? (Choose three.)
정답: A,B,C
Given:
55.
int [] x = {1, 2, 3, 4, 5};
56.
int y[] = x;
57.
System.out.println(y[2]); Which statement is true?
55.
int [] x = {1, 2, 3, 4, 5};
56.
int y[] = x;
57.
System.out.println(y[2]); Which statement is true?
정답: B