[Solved] Java error reached end of file while parsing

Previous

In this post, we will see how to solve reached end of file while parsing in java.

We generally get this error when we forgot to end code of block(class/method) with }.

Let’s understand this with the help of example.

When you compile above java file, you will get below error.

java:8: reached end of file while parsing }

Solution

To solve this issue, you just need to read code again and put curly brace at correct places.
For example:
In above program, we did not end main method correctly.

That’s all about how to solve reached end of file while parsing in java.

Previous

Add Comment