【发布时间】:2014-03-17 23:57:10
【问题描述】:
[ I am out of ideas I need a to write a code that writes and reads text files within theprocessfiles method and a code that counts and print the total number of borrowers As part of my home I need to write a class that writes and reads text files.
public void
processFiles()throws FileNotFoundException
{
[ I am struggling to write a code that actually reads and writes a text file to a windows explorer folder ]
try
{
System.out.println("Enter your Firstname");
Scanner sc=new Scanner(System.in);
String firstName=sc.nextLine();
System.out.println("Enter your lastname");
String lastName=sc.nextLine();
System.out.println("Enter your library number");
String libraryNumber=sc.nextLine();
System.out.println("Enter the number of books on loan");
int numberOfBooks=sc.nextInt();
System.out.println(firstName +" "+ lastName +" "+ libraryNumber +" "+ numberOfBooks);
int count// I am struggling to to write a code that counts the borrowers and diplay it on the windows page.
int total// I am struggling to to write a code that displays the total number of borrowers to the windows page.
input.close();
output.close();
}
catch (InputMismatchException e) [This is the catch method]
{
System.out.println("Invalid");
}
catch (Exception e) this is the catch method
{
[这是catch语句] System.out.println("错误异常"); }
input.close();[ this is the input close]
output.close(); [and output close statements]
}
}
[如果有人可以帮助我,我将不胜感激。]
【问题讨论】:
标签: java javascript file-io exception-handling fileinputstream