• Register
1 vote
14 views

Problem:

I have the following source code below:

package com.gavin;
 
public class HelloWorld {
 
	public static void main(String[] args) {
		System.out.println("Hello World !");
		
}

This code returns me an error “reached end of file while parsing java

What could be a possible solution in my case?

12 7 7
15,250 points

1 Answer

0 votes

Solution:

In your case, it’s a pretty much basic level problem. It generally happens when we forgot to open or close a curli brace. To avoid this error the best practice is to close the brace immediately once we open a brace.

Here is the correct one:

package com.gavin;
 
public class HelloWorld {
 
	public static void main(String[] args) {
		System.out.println("Hello World !");
	
    }	
}

You are all set to go now!

13 9 6
94,240 points

Related questions

1 vote
1 answer 23 views
23 views
Problem: Hello Kodlogs, I’ve written my very first program in java that is supposed to print Hello World. But for some reason, it is not displaying my expected line. It is showing error reached end of the line while parsing. Find my java program below and ... public static void main(String []args){ System.out.println("Hello World"); } Many thanks guys. I really appriciate your effort.
asked Apr 9 Gavin 15.3k points
1 vote
1 answer 184 views
184 views
Problem: Hello all, I am a new, college student who is learning python programming. I am thinking to write a program that will input a text file and read all the vowels from it and determines when it comes to the end of the file. So, is it possible to create a while loop that determines when the end of a file has been reached? Thanks in advance.
asked Mar 16 Gavin 15.3k points
0 votes
1 answer 10 views
10 views
Why doesn't ifstream.eof() return TRUE after reading the last line of the file? When a beginner starts reading an ifstream, the instinct is usually to read the file using a loop like this: while (!ifstream.eof() { ... } However, when I used this code I noticed that ... file is better off using a loop like this: while (ifstream >> someVar) { ... } Why is the first code not always working properly?
asked Aug 29 sasha 1.2k points
1 vote
1 answer 44 views
44 views
Problem: Hello guys, I am facing an error from my Python program that says python unexpected EOF while parsing. I am a newbie in python. So, it has been tough to understand and decode the problem for me alone. Could any of you please explain this in simple ... this problem and got some solutions but I couldn’t crack them at all. I am looking forward to reading your answers. Many thanks.
asked Jun 28 adamSw 11.3k points
0 votes
1 answer 347 views
347 views
Problem : Currently I am facing some issues. I am trying to use C# with Json.NET. The problem is that I always get following error: {"Unexpected character encountered while parsing value: e. Path '', line 0, position 0."} So the way I amm using Json.NET is ... as follows: {"Unexpected character encountered while parsing value: e. Path '', line 0, position 0."} Does anyone have any solution on it?
asked Dec 9, 2019 alecxe 7.5k points