-
Need help, Please
I don't understand why this is not working for me.
When I ask to println it does show me the right answer, but when I try to MessageDialog, it dosnt!!
/* Generated by Together */
import javax.swing.*;
class ConvertDgrees
{
public static void main(String[]args)
{
String cel;
int celInt;
float fer;
cel=JOptionPane.showInputDialog("Celsius?");
celInt=Integer.parseInt(cel);
fer=celInt*9/5+32;
//System.out.println(fer);
JOptionPane.showMessageDialog(null,fer);
System.exit(0);
}
}
Tal
-
This code doesn't even compile. Try passing showMessageDialog( null, new Float( fer ) ) There is no version of the shoMessageDialog method that takes a float as one of its parameters.
-gc
-
soooooooooo.....
Is there a way to change float back to String...?
Thank you for your help!!
Tal
-
float f = 1.20;
String floatString = Float.parseFloat( f );
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks