解析编译错误时到达文件末尾 [英] Reached end of file while parsing compilation error
本文介绍了解析编译错误时到达文件末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是一个java编程初学者。我做错了:在解析时到达文件结尾
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");
}
}
推荐答案
- 在您错过代码的结尾添加另一个}
if((value = "true"))
不是检查字符串相等性的正确方法,并且存在语法错误。
is not a proper way to check string equality and has syntax error it should be
if(value.equals("true"))
这篇关于解析编译错误时到达文件末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文