Blanka Tierrablanca

Greenhorn
+ Follow
since Feb 08, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Blanka Tierrablanca

I want to write an Integer Object to the disk and then read it back. I can't figure out the command for reading it back. I know it needs to be cast as appropriate wrapper class. Someone please help.
Thanks
File fd = new File("d:\\Number.dat");
try {
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(fd));
out.writeObject(new Integer(17));
out.close();
ObjectInputStream in = new ObjectInputStream(new FileInputStream(fd));
System.out.println( (in.readObject).intValue() );
}
catch (Exception e) {}
}
}
20 years ago
I've tried different things and I'm running out of ideas. I know it's probably something very simple that I'm overlooking. Here's the part that I think has problem in it. Whole program is kind of big too include (250 lines). This is where error comes from:

else {
// get input from TextField
int result;
int temperature = Integer.parseInt(input.getText().trim());

// get selected type of conversion and convert it
if (fahrenheit.getState() == true)
result = 5 * (temperature - 32) / 9;
if (celsius.getState() == true )
result = (9 * temperature / 5) + 32;

// format the output
output.setText(String.valueOf(result));
}
21 years ago
Now I'm getting an error that says "variable result might not have been initialized"
How do I fix it?
21 years ago
I'm trying to display a result in a label but I keep getting an error message that setText can't be applied to int so I tried different things to change it to String but it wouldn't accept it. Plese help.
output.setText(result);
Thank you.
21 years ago
I'm trying to change the text of the title once the window is minimized but I only figured out how to change text in the window not the Title bar.
Please help.
public void windowIconified(WindowEvent e) {
???
}
Please let me know what command I should use and I should be all set.
21 years ago
I'm trying to change the text of the title once the window is minimized but I only figured out how to change text in the window not the Title bar.
Please help.
public void windowIconified(WindowEvent e) {
???
}
Please let me know what command I should use and I should be all set.
Thank you.
21 years ago