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.
1 2 3 4 5 6 7 8 9 10 |
package org.arpit.java2blog; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello world from java2blog"); } |
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.
1 2 3 4 5 6 7 8 9 10 |
package org.arpit.java2blog; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello world from java2blog"); } } |
That’s all about how to solve reached end of file while parsing in java.
Was this post helpful?
Let us know if this post was helpful. Feedbacks are monitored on daily basis. Please do provide feedback as that\'s the only way to improve.