1z0-809 Korean 無料問題集「Oracle Java SE 8 Programmer II (1z0-809 Korean Version)」
주어진 코드 조각:
클래스 MyThread 구현 Runnable {
private static AtomicInteger count = new AtomicInteger (0);
public void run () {
int x = count.incrementAndGet();
System.out.print (x+" ");
}
}
and
Thread thread1 = new Thread(new MyThread());
Thread thread2 = new Thread(new MyThread());
Thread thread3 = new Thread(new MyThread());
Thread [] ta = {thread1, thread2, thread3};
for (int x= 0; x < 3; x++) {
ta[x].start();
}
어떤 말이 진실이야?
클래스 MyThread 구현 Runnable {
private static AtomicInteger count = new AtomicInteger (0);
public void run () {
int x = count.incrementAndGet();
System.out.print (x+" ");
}
}
and
Thread thread1 = new Thread(new MyThread());
Thread thread2 = new Thread(new MyThread());
Thread thread3 = new Thread(new MyThread());
Thread [] ta = {thread1, thread2, thread3};
for (int x= 0; x < 3; x++) {
ta[x].start();
}
어떤 말이 진실이야?
正解:C
解答を投票する
Vehicle 클래스의 정의가 주어지면:
Class Vehhicle {
int distance;//line n1
Vehicle (int x) {
this distance = x;
}
공개 무효 increSpeed(int 시간) {//라인 n2
int timeTravel = 시간;//라인 n3
class Car {
int value = 0;
public void speed () {
value = distance /timeTravel;
System.out.println ("Velocity with new speed"+value+"kmph");
}
}
new Car().speed();
}
}
이 코드 조각:
차량 v = 새 차량(100);
v.increSpeed(60);
결과는 무엇입니까?
Class Vehhicle {
int distance;//line n1
Vehicle (int x) {
this distance = x;
}
공개 무효 increSpeed(int 시간) {//라인 n2
int timeTravel = 시간;//라인 n3
class Car {
int value = 0;
public void speed () {
value = distance /timeTravel;
System.out.println ("Velocity with new speed"+value+"kmph");
}
}
new Car().speed();
}
}
이 코드 조각:
차량 v = 새 차량(100);
v.increSpeed(60);
결과는 무엇입니까?
正解:C
解答を投票する
주어진:
public class product {
int id; int price;
public Product (int id, int price) {
this.id = id;
this.price = price;
}
public String toString() { return id + ":" + price; }
}
and the code fragment:
List<Product> products = Arrays.asList(new Product(1, 10),
new Product (2, 30),
new Product (2, 30));
Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -> {
p1.price+=p2.price;
return new Product (p1.id, p1.price);});
products.add(p);
products.stream().parallel()
.reduce((p1, p2) - > p1.price > p2.price ? p1 : p2)
.ifPresent(System.out: :println);
결과는 무엇입니까?
public class product {
int id; int price;
public Product (int id, int price) {
this.id = id;
this.price = price;
}
public String toString() { return id + ":" + price; }
}
and the code fragment:
List<Product> products = Arrays.asList(new Product(1, 10),
new Product (2, 30),
new Product (2, 30));
Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -> {
p1.price+=p2.price;
return new Product (p1.id, p1.price);});
products.add(p);
products.stream().parallel()
.reduce((p1, p2) - > p1.price > p2.price ? p1 : p2)
.ifPresent(System.out: :println);
결과는 무엇입니까?
正解:E
解答を投票する