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. What will be the output of the following Java code?
Q. What is the other name for Relational Operators in Java?
Q. How do you change the current layout manager for a container?
Q. Which of the following package stores all the standard java classes?
Q. Java is a Successor to which programming language?
Discusssion
Login to discuss.