Convert Strings In Java - Post ID 79605

User 1870742 Photo


Guest
1 post

Hello,
How to convert String into primitive datatype.also give me a program where you clearly define the primitive datatypes. Please reply my post if you know the answer.

Thanks
User 364143 Photo


Guest
5,410 posts

This is done by the compiler. I would suggest a google search would return plenty of leads but you can simply look in your textbook. Do your own homework. You will not regret it. :D

Or was your very first post only to spam the site with your links?
CoffeeCup... Yeah, they are the best!
User 1882374 Photo


Guest
1 post

Gracey smith wrote:
Hello,
How to convert String into primitive datatype.also give me a program where you clearly define the primitive datatypes. Please reply my post if you know the answer.

Thanks


using parseInt() method for example

//String to primitive types
int iVal = Integer.parseInt(str);
long lVal = Long.parseLong(str);
float fVal = Float.parseFloat(str);
double dVal = Double.parseDouble(str);
User 244141 Photo


Ambassador
1,209 posts

Tom, by the answer, I think you might be right.
Web Design: https://www.websnoogie.com
Member - BBB: Websnoogie, LLC







Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.