gpt4 book ai didi

java - 扫描仪输入新的扫描仪(文档); <--------错误;预期

转载 作者:行者123 更新时间:2023-12-02 11:07:22 25 4
gpt4 key购买 nike

我正在尝试进行编译,但似乎收到一条错误消息,指出我在具有;的行上缺少;。我还查看了代码,自己也看不到错误。我希望你能指出正确的方向:)

import java.io.*;
import java.util.*;


public class marks
{

private String asses;
private int mark;


public marks()
{


}


public void createFile() throws Exception
{
File doc;
doc = new File ("marks.txt");
if(!doc.exists()){
doc.createNewFile();
System.out.println("A New File Has been Created");
}
else {
System.out.println ("File Already Exists");
}
}

public void enterMarks()
{
Scanner input new Scaner(doc); <---------- Error ; expected

while (input.hasNext()){
String asses = input.next();
int mark = input.nextInt();
System.out.println( asses +" "+ mark);
}
}
}

最佳答案

您缺少=:

Scanner input = new Scanner(doc);

关于java - 扫描仪输入新的扫描仪(文档); <--------错误;预期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5299220/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com