Java novice here. So, I was learning Java from this book, Java and Algorithmic Thinking for the Complete Beginner, by Aristides S. Bouras and was stuck at learning the syntax for user input. Here's the original code snippet from the book
java.io.BufferedReader cin = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
String name;
int age;
name = cin.readLine();
age = Integer.parseInt(cin.readLine());
System.out.print("Wow, you are already" + age + "years old," + name + "!");
I tried using the exact code from above in IntelliJ, but I got the following error:
I was thinking to "walk around" this problem with other types of input methods from this article using the scanner method, but any insight into the error would be highly appreciated. And also, I believe that including the "java.io." for three times in a row is unnecessary for the first line of code right? Please humble my questioning if there's a reason to it. Thank you all!