Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Bounty
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
974
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