File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in casting

 
Dhivya rajagopal
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello, I created one text box, 2 labels and 2 buttons in swings using net beans. 2 labels caption are Fahrenheit and Celsius. 2 buttons caption are convert and clear.
The Program is to convert the given input to Fahrenheit.



If we click convert button, the above thing will execute. My doubt is in the above program, why don't i give the line which is commented instead of the above line. can you explain

Thank you in advance
 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're getting the temperature as a String. You need to convert it to a number with Double.parseDouble(), but your second version doesn't do that.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic