Oracle
1Z0-819 · Question #121
1Z0-819 Question #121: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #121. The question stem and answer options stay visible for context.
Question
Given: public interface API { //line 1
public void checkValue(Object value)
throws IllegalArgumentException; //line 2
public boolean isValidNumber(Object val) {
if (val instanceof Number) {
return true;
}else{
try {
Double.parseDouble(val.toString());
return true;
}catch (NumberFormatException ex) {
return false;
}
}
}
}
Which two changes need to be made to make this class compile? (Choose two.)
Options
- AChange Line 1 to an abstract class:public abstract class API {
- BChange Line 2 access modifier to protected:protected void checkValue(Object value)throws IllegalArgumentException;
- CChange Line 1 to AutoClosable:public API implements AutoCloseable {
- DChange Line 2 to an abstract method:public abstract void checkValue(Object value)throws IllegalArgumentException;
- EChange Line 1 to extend java.lang.AutoClosable:public interface API extends AutoCloseable {
Unlock 1Z0-819 to see the answer
You've previewed enough free 1Z0-819 questions. Unlock 1Z0-819 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.