Celeb Glow
news | March 09, 2026

Why do I get an error that says "reached end of file while parsing"? [closed]

Okay so I made a simple thing in Java. Here it is.

class MyClass { public static void main(String[ ] args) { // Scanner initialization Scanner myInfo = new Scanner(System.in); System.out.println("Who are you? "); String inputName = myInfo.nextLine(); System.out.println("How old are you? "); int inputAge = myInfo.nextInt(); System.out.println("What is your aim? "); String inputAim = myInfo.next(); System.out.println("My name is " +inputName+ "I am " +inputAge+ "years old. I wanna be a " +inputAim);

When I try to run it, it gives me an error that says "reached end of file while parsing".

2

1 Answer

I know little about Java but you have two { characters and no }. I blindly bet this is the culprit. End of file is unexpected until all opening brackets meet their closing counterparts.