P
pageV
In this code bit:
void saveData()
{
String out;
try
{
//output = new BufferedWriter (file ) ;
try
{
out = Double.toString(index);
output.write( out + " ") ;
out = Double.toString(twoDig.format(total));
output.write( out + "\n");
}
}
catch( IOException ioe )
{
JOptionPane.showMessageDialog( null, "Err: " + ioe );
}
}
I commented out "output = new BufferedWriter (file ) ;" to move it outside
the method so I could write more than one line to the file. Also
moved the close statement outside the method so I could write more than one
line.
But it writes only the last line before I close it. That's the first
problem.
Then I added a line elsewhere in the program to change the look and feel
and the compiler started complaining about try without catch. So I commented
out one of the try's and a pair of brackets. Now I get
Coffee.java:188: cannot resolve symbol
symbol : method toString (java.lang.String)
location: class java.lang.Double
out = Double.toString(twoDig.format(total));
^
Put the try back in and get both errors.
Commented out the look and feel statement and still
get the errors. I can fix the try error but I can't
get back to where I was when the compiler accepted
the Double.toString.
Any solutions?
Ralph
void saveData()
{
String out;
try
{
//output = new BufferedWriter (file ) ;
try
{
out = Double.toString(index);
output.write( out + " ") ;
out = Double.toString(twoDig.format(total));
output.write( out + "\n");
}
}
catch( IOException ioe )
{
JOptionPane.showMessageDialog( null, "Err: " + ioe );
}
}
I commented out "output = new BufferedWriter (file ) ;" to move it outside
the method so I could write more than one line to the file. Also
moved the close statement outside the method so I could write more than one
line.
But it writes only the last line before I close it. That's the first
problem.
Then I added a line elsewhere in the program to change the look and feel
and the compiler started complaining about try without catch. So I commented
out one of the try's and a pair of brackets. Now I get
Coffee.java:188: cannot resolve symbol
symbol : method toString (java.lang.String)
location: class java.lang.Double
out = Double.toString(twoDig.format(total));
^
Put the try back in and get both errors.
Commented out the look and feel statement and still
get the errors. I can fix the try error but I can't
get back to where I was when the compiler accepted
the Double.toString.
Any solutions?
Ralph