Given:
3. class Employee { 4. private String name; 5. void setName(String n) { name = n; } 6. String getName() { return name; } 7. } //from www.java 2 s . co m 8. interface Printable { 9. void print(); 10. } 11. public class Main implements Printable { 12. public void print() { ; } 13. public static void main(String[] args) { 14. Employee e = new Employee(); 15. e.setName("bob"); 16. System.out.print(e.getName()); 17. } 18. }
Which are true? (Choose all that apply.)
B, E, and F are correct statements about the code.
A and C are incorrect because the Main class "uses" the Employee class, but Main isn't in Employee's class hierarchy, and Main doesn't "have" an Employee as part of its state.
D is similarly incorrect because Main doesn't "have" a Printable as part of its state.