代码,无法理解为什么我们有错误一切看起来都很好。请帮忙import java.io.*;public class ReadKeyboard3{ public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); BufferedReader in = new BufferedReader(isr); System.out.print("Enter marks for English: "); String EnglishMarks = scanner.readline(); int English = Integer.parseInt(EnglishMarks); System.out.print("Enter marks for Maths: "); String MathsMarks = in.readLine(); int Maths = Integer.parseInt(MathsMarks); System.out.print("Enter marks for Science: "); String ScienceMarks = in.readLine(); int Science = Integer.parseInt(ScienceMarks); float avg = (English + Maths + Science)/3; system.out.println("Average of all 3 subjects:" +avg); }}错误:ReadKeyboard3.java:10: error: cannot find symbol String EnglishMarks = in.readline(); ^ symbol: method readline() location: variable in of type BufferedReaderReadKeyboard3.java:22: error: package system does not exist system.out.println("Average of all 3 subjects:" +avg);谁能帮助我理解错误
1 回答
牛魔王的故事
TA贡献1830条经验 获得超3个赞
您尝试调用的实际函数是readLine()
(not readline()
)。同样在第 22 行,使用System
而不是system
(因为 Java 区分大小写,如注释中所述)此外,对于 using Scanner
,您需要导入java.util.Scanner
.
添加回答
举报
0/150
提交
取消