1z0-809 Korean 無料問題集「Oracle Java SE 8 Programmer II (1z0-809 Korean Version)」
주어진:
공개 열거형 USCurrency {
PENNY (1),
NICKLE(5),
DIME (10),
QUARTER(25);
private int value;
public USCurrency(int value) {
this.value = value;
}
public int getValue() {return value;}
}
public class Coin {
public static void main (String[] args) {
USCurrency usCoin =new USCurrency.DIME;
System.out.println(usCoin.getValue()):
}
}
주어진 코드를 컴파일할 수 있는 두 가지 수정 사항은 무엇입니까? (2개를 선택하세요.)
공개 열거형 USCurrency {
PENNY (1),
NICKLE(5),
DIME (10),
QUARTER(25);
private int value;
public USCurrency(int value) {
this.value = value;
}
public int getValue() {return value;}
}
public class Coin {
public static void main (String[] args) {
USCurrency usCoin =new USCurrency.DIME;
System.out.println(usCoin.getValue()):
}
}
주어진 코드를 컴파일할 수 있는 두 가지 수정 사항은 무엇입니까? (2개를 선택하세요.)
正解:A、D
解答を投票する
주어진:
class Worker extends Thread {
CyclicBarrier cb;
public Worker(CyclicBarrier cb) { this.cb = cb; }
public void run () {
try {
cb.await();
System.out.println("Worker...");
} catch (Exception ex) { }
}
}
class Master implements Runnable { //line n1
public void run () {
System.out.println("Master...");
}
}
and the code fragment:
Master master = new Master();
//line n2
Worker worker = new Worker(cb);
worker.start();
작업자 및 마스터 클래스의 실행 메소드가 모두 실행되는지 확인하라는 요청을 받았습니다.
어떤 수정이 요구 사항을 충족합니까?
class Worker extends Thread {
CyclicBarrier cb;
public Worker(CyclicBarrier cb) { this.cb = cb; }
public void run () {
try {
cb.await();
System.out.println("Worker...");
} catch (Exception ex) { }
}
}
class Master implements Runnable { //line n1
public void run () {
System.out.println("Master...");
}
}
and the code fragment:
Master master = new Master();
//line n2
Worker worker = new Worker(cb);
worker.start();
작업자 및 마스터 클래스의 실행 메소드가 모두 실행되는지 확인하라는 요청을 받았습니다.
어떤 수정이 요구 사항을 충족합니까?
正解:D
解答を投票する
주어진:
클래스 RateOfInterest {
public static void main (String[] args) {
int rateOfInterest = 0;
String accountType = "LOAN";
switch (accountType) {
case "RD";
rateOfInterest = 5;
break;
case "FD";
rateOfInterest = 10;
break;
default:
assert false: "No interest for this account"; //line n1
}
System.out.println ("Rate of interest:" + rateOfInterest);
}
}
및 명령:
java -ea RateOfInterest
결과는 무엇입니까?
클래스 RateOfInterest {
public static void main (String[] args) {
int rateOfInterest = 0;
String accountType = "LOAN";
switch (accountType) {
case "RD";
rateOfInterest = 5;
break;
case "FD";
rateOfInterest = 10;
break;
default:
assert false: "No interest for this account"; //line n1
}
System.out.println ("Rate of interest:" + rateOfInterest);
}
}
및 명령:
java -ea RateOfInterest
결과는 무엇입니까?
正解:A
解答を投票する
주어진 코드 조각:
스트림<경로> 파일 = Files.walk(Paths.get(System.getProperty("user.home"))); files.forEach(fName -> {//라인 n1 try { 경로 aPath = fName.toAbsolutePath();//라인 n2 System.out.println(fName + ":"
+ Files.readAttributes(aPath, Basic.File.Attributes.class).creationTime());
} catch(IOException 예) {
ex.printStackTrace();
});
결과는 무엇입니까?
스트림<경로> 파일 = Files.walk(Paths.get(System.getProperty("user.home"))); files.forEach(fName -> {//라인 n1 try { 경로 aPath = fName.toAbsolutePath();//라인 n2 System.out.println(fName + ":"
+ Files.readAttributes(aPath, Basic.File.Attributes.class).creationTime());
} catch(IOException 예) {
ex.printStackTrace();
});
결과는 무엇입니까?
正解:B
解答を投票する