Reputation: 3
I am a java programming beginner. What did i do to get the error: reached end of file while parsing
import java.util.Scanner;
class eng{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
String value;
String direct = "answer true or false to the following statement.";
String ques = "Twelve is greater than seven";
System.out.println(direct);
System.out.println(ques);
value = input.nextLine();
if ((value = "true")) {
System.out.println("you are correct");
} else {
System.out.println("you are wrong my friend");
}
}
Upvotes: 0
Views: 284
Reputation: 11
Please re-indent/re-format your code first. Maybe you'll find a missing end brace "}".
Upvotes: 0
Reputation: 1310
2.There is another error in your code
if((value = "true"))
is not a proper way to check string equality and has syntax error it should be
if(value.equals("true"))
Upvotes: 2
Reputation: 3779
You're simply missing a closing brace }
. From what the compiler sees you never closed the brace after class eng{
Upvotes: 0