when i run a program, and try to type in a decimal as input i always get an error? what can be the problem? should i use int or double? help!
peedi
0
Light Poster
Recommended Answers
Jump to PostWhat you retrieving from user is String. You need to convert this String to double type as follows
double myDouble = Double.parseDouble(myString)
Reference, here
All 3 Replies
peter_budo
2,532
Code tags enforcer
Team Colleague
Featured Poster
peedi
0
Light Poster
BestJewSinceJC
700
Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.