• Register
1 vote
16 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

Please log in or register to answer this question.

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

0 votes
1 answer 8 views
8 views
What am I doing wrong? Any help appreciated.
asked Dec 30, 2020 TeamScript 9.9k points
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, 2020 Gavin 15.3k points
1 vote
1 answer 240 views
240 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, 2020 Gavin 15.3k points
0 votes
1 answer 13 views
13 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, 2020 sasha 5.3k points
0 votes
1 answer 18 views
18 views
Has anybody got any ideas?
asked Jan 2 TeamScript 9.9k points
0 votes
1 answer 7 views
7 views
Has anybody got any ideas?
asked Dec 19, 2020 TeamScript 9.9k points
1 vote
1 answer 57 views
57 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, 2020 adamSw 11.3k points
0 votes
1 answer 484 views
484 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
0 votes
1 answer 11 views
11 views
Problem: The following C++ code uses a ifstream object to read integers from a text file (which has one number per line) until it hits EOF. Why does it read the integer on the last line twice? How to fix this? Code: #include <iostream> #include <fstream> using namespace std; int main() { ... txt has integers, one per line while (!iFile.eof()) { int x; iFile >> x; cerr << x << endl; } return 0; }
asked Dec 25, 2020 Mashhoodch 5.7k points
0 votes
1 answer 11 views
11 views
Problem I am facing some strange behavior of PHP. I am new in PHP, but it are not my first lines in PHP. For some reason I am getting: Parse error: syntax error, unexpected end of file in the line Here is the adapted code: <html> <head> </head> <body> <?php function authenticate() ... Tally</a> <?php} else { echo "Wrong login details. Please try again"; } ?> <!-- HTML stuff --> </body> </html>
asked Dec 7, 2020 alexh 2.2k points