Scanner input new Scaner(doc); <---------- Error ; expected
I am trying to compile but I seem to be getting an error stating I am missing a ;
on a line that has the ;
. I have also looked around the code and can't see an error myself. I hope that you can point me in the right direction :)
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);
}
}
}
You're missing an =
:
Scanner input = new Scanner(doc);
Scanner input = new Scanner(doc);
"=" is missing and Scanner
spells wrong; change visibility doc
to global
精彩评论