Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes Doubt in casting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Doubt in casting" Watch "Doubt in casting" New topic

Doubt in casting

Dhivya rajagopal
Ranch Hand

Joined: Dec 15, 2010
Posts: 42

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

Joined: Apr 06, 2010
Posts: 4344

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:
subject: Doubt in casting
Similar Threads
Simple: Turning A Program Into An Applet
filing an array with the output from a method
Exceptions doubt
doubt in update