Why is output Parsing Error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
25th Nov 2018, 12:05 PM
Dell
Dell - avatar
2 Answers
+ 1
My reason is because of the parsing Integer.parseInt(s); The 5.6 itself is a decimal value so we can't convert it to integer, instead we have to use double/float right? So because of that error it creates an exception which is handled by the catch and so it outputs Parsing Error Hence the other codes will be skipped Need some clarification if this is correct haha
25th Nov 2018, 12:07 PM
Dell
Dell - avatar
+ 4
Dell's answer is right. You parsed the string incorrectly. You should use Double.parseDouble(s);
25th Nov 2018, 1:11 PM
Lambda_Driver
Lambda_Driver - avatar