import java.io.*;
class AccountInfo {
private String lastName;
private String firstName;
private int age;
private float accountBalance;
protected AccountInfo(final String last,final String first,final int ag,final float balance) throws IOException{
lastName=last;
firstName=first;
age=ag;
accountBalance=balance;
}
public void saveState(final OutputStream stream){try{
OutputStreamWriter osw=new OutputStreamWriter(stream);
BufferedWriter bw=new BufferedWriter(osw);
bw.write(lastName);
bw.newLine();
bw.write(firstName);
bw.write(age);
bw.write(Float.toString(accountBalance));
bw.close();}
catch(IOException e){
System.out.println (e);
}
}
public void restoreState(final InputStream stream)throws IOException{
try{
InputStreamReader isr=new InputStreamReader(stream);
BufferedReader br=new BufferedReader(isr);
lastName=br.readLine();
firstName=br.readLine();
age=Integer.parseInt(br.readLine());
accountBalance=Float.parseFloat(br.readLine());
br.close();}
catch(IOException e){
System.out.println (e);
}
}
}
class accounto{
public static void main (String[] args) {try{
AccountInfo obj=new AccountInfo("chaturvedi","aayush",18,18);
FileInputStream fis=new FileInputStream("Account.txt");
FileOutputStream fos=new FileOutputStream("Account,txt");
obj.saveState(fos);
obj.restoreState(fis);}
catch(IOException e){
System.out.println (e);
}
}
}
即时得到以下错误:异常线程“main” java.lang.NumberFormatException:空在java.lang.Integer.parseInt(Integer.java:454)在java.lang.Integer.parseInt(Integer.java:527)在AccountInfo.restoreState(accounto.java:43)在accounto.main(accounto.java:60)