FAQs
Search
Recent Topics
Flagged Topics
Hot Topics
Best Topics
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Bear Bibeault
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
Tim Cooke
Junilu Lacar
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Jj Roberts
Carey Brown
Bartenders:
salvin francis
Frits Walraven
Piet Souris
Forum:
Java in General
Converting String value 2.0 into int
saumil baxi
Ranch Hand
Posts: 58
posted 12 years ago
Hi ,
I have s
String
variable having value 2.0 I need to convert it into int.
The method i have used is :
[B]String s = "2.0"; float floatTemp = Float.valueOf(s).floatValue(); int intTemp = (int) floatTemp;[/B]
Is there any straight forward implementation..
Thanks,
Saumil
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
I like...
posted 12 years ago
Just change your code like this
String s = "2.0"; int intTemp = Float.valueOf(s).intValue();
saumil baxi
Ranch Hand
Posts: 58
posted 12 years ago
Thanks a lot
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
the importance of wrappers
I need help,a question about String objects!
overriding equals method in my class
is there any way pass arguments to class method without overloading ?
String Class Method
More...