C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Convert the String to Float & Double data type in Java Program
WhatsApp
Alagunila Meganathan
Aug 08
2016
1
k
0
1
ConvertStringToFloat
public
class
ConvertStringToFloat{
public
static
void
main(String[] args) {
System.out.println(
"Convert string to float example!"
);
String str =
"5"
;
Float f =
new
Float(str);
double
d = f.doubleValue();
System.out.println(
"float value:"
+f);
System.out.println(
"double value:"
+d);
}
}
java
string
double
Up Next
Convert the String to Float & Double data type in Java Program