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. String[][] students = {{"Bobby", 87}, {"Charles", 100}, {"Eric", 64},
  13. {"Charles", 22}};
  14.  
  15. Map<String, List<Integer>> map = new HashMap<>();
  16. List<Integer> score1 = new ArrayList<>();
  17. for(int i=0; i<students.length; i++) {
  18. score1.add(students[i][1]);
  19. map.put(students[i][0], score1);
  20. }
  21. }
  22. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: incompatible types: int cannot be converted to String
		String[][] students = {{"Bobby", 87}, {"Charles", 100}, {"Eric", 64}, 
		                                 ^
Main.java:12: error: incompatible types: int cannot be converted to String
		String[][] students = {{"Bobby", 87}, {"Charles", 100}, {"Eric", 64}, 
		                                                  ^
Main.java:12: error: incompatible types: int cannot be converted to String
		String[][] students = {{"Bobby", 87}, {"Charles", 100}, {"Eric", 64}, 
		                                                                 ^
Main.java:13: error: incompatible types: int cannot be converted to String
                               {"Charles", 22}};
                                           ^
Main.java:18: error: no suitable method found for add(String)
		    score1.add(students[i][1]);
		          ^
    method Collection.add(Integer) is not applicable
      (argument mismatch; String cannot be converted to Integer)
    method List.add(Integer) is not applicable
      (argument mismatch; String cannot be converted to Integer)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
5 errors
stdout
Standard output is empty