try{
out = new Formatter("allaccounts.txt");
}
catch(FileNotFoundException ex){
System.err.println("Error: File not Found!");
System.exit(1);
return;
}
for(int i = 0; i < start.getnumAcc();i++)
{
outs.format("%d ",users[i].getNum());
outs.format("%s ",users[i].getName());
outs.format("%s ",users[i].getPass());
outs.format("%d\n",users[i].getBalan()); //returns double- line that throws the exception
}
outs.close();
Quote
|
Integral - may be applied to Java integral types: byte, Byte, short, Short, int and Integer, long, Long, and BigInteger
The number of digits in the result for the fractional part of m or a is equal to the precision. If the precision is not specified then the default value is 6. If the precision is less than the number of digits which would appear after the decimal point in the string returned by Float.toString(float) or Double.toString(double) respectively, then the value will be rounded using the round half up algorithm (http://docs.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html#ROUND_HALF_UP). Otherwise, zeros may be appended to reach the precision. For a canonical representation of the value,use Float.toString(float) or Double.toString(double) as appropriate.