Question 6
Which statement best describes encapsulation?
Question 7
Given:
interface Doable {
public void doSomething (String s);
}
Which two class definitions compile? (Choose two.)
interface Doable {
public void doSomething (String s);
}
Which two class definitions compile? (Choose two.)
Question 8
Given:

Which two interfaces can you use to create lambda expressions? (Choose two.)

Which two interfaces can you use to create lambda expressions? (Choose two.)
Question 9
Given:
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
public void doRegister(String name, int age)
throws UserException, AgeOutOfLimitException {
if (name.length () < 6) {
throw new UserException ();
} else if (age >= 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println("User is registered.");
}
}
public static void main(String[ ] args) throws UserException {
App t = new App ();
t.doRegister("Mathew", 60);
}
}
What is the result?
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
public void doRegister(String name, int age)
throws UserException, AgeOutOfLimitException {
if (name.length () < 6) {
throw new UserException ();
} else if (age >= 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println("User is registered.");
}
}
public static void main(String[ ] args) throws UserException {
App t = new App ();
t.doRegister("Mathew", 60);
}
}
What is the result?
Question 10
Given the code fragment:

What is the result?

What is the result?