+ 4
Java input problem
I will create a simple program that converts inch to cm. It gets user data in double and multiplied it by 2.54 and stores it to a variable. But the problem is when I use Scanner and multiple it by 2.54 it says that you can not store a scanner value into a double! My question is when should I must use .nextDouble or is there a short way to convert sccaner to double? Ps: I read this program in js with no problem.
3 Respuestas
+ 6
Scanner sc = new Scanner(System.in);
double cm = sc.nextDouble();
This is how you get input, wonder how you got problems.
+ 10
Hello, 😊
If you need help you can post the code you are struggling with!
• SEARCH for similar QUESTIONS or ANSWERS before posting
• Include relevant TAGS
• https://www.sololearn.com/post/75089/?ref=app
• https://code.sololearn.com/WvG0MJq2dQ6y/
+ 3
Prometheus 🇸🇬 Thank you very much.