fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. HashMap<Integer, String> hmap = new HashMap<Integer, Integer, String>();
  13.  
  14. /*Adding elements to HashMap*/
  15. hmap.put(12,2014, "Chaitanya");
  16. hmap.put(2,2014, "Rahul");
  17. hmap.put(7,2015, "Singh");
  18. hmap.put(49,2015, "Ajeet");
  19. hmap.put(3,2016, "Anuj");
  20. System.out.println(hmap.get(7));
  21. }
  22. }
Compilation error #stdin compilation error #stdout 0.1s 321600KB
stdin
Standard input is empty
compilation info
Main.java:12: error: wrong number of type arguments; required 2
		HashMap<Integer, String> hmap = new HashMap<Integer, Integer, String>();
		                                           ^
Main.java:15: error: no suitable method found for put(int,int,String)
	      hmap.put(12,2014, "Chaitanya");
	          ^
    method Map.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method AbstractMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method HashMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
Main.java:16: error: no suitable method found for put(int,int,String)
	      hmap.put(2,2014, "Rahul");
	          ^
    method Map.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method AbstractMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method HashMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
Main.java:17: error: no suitable method found for put(int,int,String)
	      hmap.put(7,2015, "Singh");
	          ^
    method Map.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method AbstractMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method HashMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
Main.java:18: error: no suitable method found for put(int,int,String)
	      hmap.put(49,2015, "Ajeet");
	          ^
    method Map.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method AbstractMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method HashMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
Main.java:19: error: no suitable method found for put(int,int,String)
	      hmap.put(3,2016, "Anuj");
	          ^
    method Map.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method AbstractMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
    method HashMap.put(Integer,String) is not applicable
      (actual and formal argument lists differ in length)
6 errors
stdout
Standard output is empty