U
Q. What will be the output of the following code –
import java. util.HashMap; class newEmployee { private String name; public newEmployee (String name) { this.name = name; } @Override public int hashCode() { return 1; } } class EmployeeClass { public static void main(String args[]) { HashMap<newEmployee,String> hm=new HashMap<newEmployee,String>(); hm.put(new newEmployee(“a”),”emp1″); hm.put(new newEmployee(“b”),”emp2″); hm.put(new newEmployee(“a”),”emp1 overridden”); System.out.println(hm.size()); System.out.println(hm.get(new newEmployee(“a”))); } }
No solution found for this question.
Add Solution and get +2 points.
You must be Logged in to update hint/solution
Be the first to start discuss.
Q. In Java, can a subclass access protected members (fields and methods) of its superclass?
Q. Show some networking terminology given below?
Q. What will be the output of the following Java code?
Q. What is the output of relational operators?
Q. What are the types of memory allocated in memory in java?
Q. Which of the following declares an abstract method in an abstract Java class?
Q. What is the output of the following code?
Q. Which of the following package stores all the standard java classes?
Discusssion
Login to discuss.