Java Reference
In-Depth Information
A.
A NoClassDefFoundError occurs.
B.
A ClassNotFoundException occurs.
C.
Test.class is generated in the c:\abcproject\deploy directory.
D.
Test.class is generated in the c:\abcproject\deploy\abc directory.
E.
Test.class is generated in the c:\abcproject\deploy\a\b\c directory.
4.
What is the outcome of the following code?
1. public class Employee {
2. public int employeeId;
3. public String firstName, lastName;
4. public java.util.GregorianCalendar hireDate;
5.
6. public int hashCode() {
7. return employeeId;
8. }
9.
10. public boolean equals(Employee e) {
11. return this.employeeId == e.employeeId;
12. }
13.
14. public static void main(String [] args) {
15. Employee one = new Employee();
16. one.employeeId = 101;
17.
18. Employee two = new Employee();
19. two.employeeId = 101;
20.
21. if(one.equals(two)) {
22. System.out.println(“Success”);
23. } else {
24. System.out.println(“Failure”);
25. }
26. }
27. }
A.
Success
B.
Failure
C.
Line 6 causes a compiler error.
D.
Line 10 causes a compiler error.
E.
Line 10 causes a runtime exception to occur.
Search WWH ::
Custom Search