Need help, Please


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Need help, Please

  1. #1
    Join Date
    Nov 2002
    Posts
    4

    Lightbulb 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

  2. #2
    Join Date
    Jul 2002
    Posts
    26
    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

  3. #3
    Join Date
    Nov 2002
    Posts
    4

    soooooooooo.....

    Is there a way to change float back to String...?

    Thank you for your help!!
    Tal

  4. #4
    Join Date
    Jul 2002
    Posts
    26
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center