所以我想返回扫描仪,专门文件
public static Scanner fileWriter()
{
Scanner sc = new Scanner(System.in);
System.out.println("What is the name of the file? (succeeded by .txt)");
//String firs = sc.nextLine();
try
{
Scanner scanner = new Scanner(new File("Test.txt"));
}
catch(IOException e)
{
System.out.println("Io exception" + e.getMessage());
}
return scanner;
}
虽然这工作,我有问题的唯一的事情是“回归扫描仪”。
的错误是“无法找到符号”
return scanner;
^
我在做什么错? !:(谢谢
变量有*范围*。具体来说,就是封闭块。 –