I get NumberFormatException: For input string: "String1" but I can't find out why, please help me :)
package com.codegym.task.task10.task1019;
import java.io.*;
import java.util.*;
/*
Functionality is not enough!
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
Map<String, Integer> map = new HashMap<>();
while(true){
if (reader.readLine().isEmpty()){
break;
}
else{
Integer id = Integer.parseInt(reader.readLine());
String name = reader.readLine();
if (name.isEmpty()){
map.put(name, id);
break;
}
else{
map.put(name, id);
}
}
}
for(Map.Entry<String, Integer> pair : map.entrySet()){
System.out.println("Id=" + pair.getValue() + " Name=" + pair.getKey());
}
}
}