The correct answer is the letter B, in cases of EXCEPTIONS you need to declare in the constructor "throws LogFileException". In the case of a RuntimeException you don't need to.
Answer is B
Tested:
public class App {
public static void main(String[] args) {
App obj = new App();
try {
obj.open();
obj.process();
throw new LogFileException();
}
catch (Exception e) {
// TODO: handle exception
}
}
void process() throws LogFileException{
System.out.println("Processed");
throw new LogFileException();
}
void open() {
System.out.println("Opened");
throw new AccessViolationException();
}
}
class LogFileException extends Exception {}
class AccessViolationException extends RuntimeException {}
upvoted 4 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
iSnover
3 months, 1 week agoshivkumarx
4 months ago