+ 3

Wrong answer??

How this could be RuntimeException I tried compiling it It's giving Compile time error https://www.sololearn.com/post/216048/?ref=app

10th Jan 2020, 5:04 PM
Shubham kumar
Shubham kumar - avatar
12 Respuestas
+ 9
Jayakrishna ,it's compile time error due to misspelled method name. It should be parseInt() not parse() If it was parseInt then only runtime exception (NumberFormatException) would has been thrown :)
10th Jan 2020, 11:36 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 3
Shubham kumar , report that question by clicking on ⚠ symbol at top right corner.
10th Jan 2020, 5:30 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 3
🌀Saroj Patel🌀🇮🇳 , No. It's obviously a compile time error. Integer class doesn't not have any method with signature : public static int parse(String s) however there is a public static int parseInt(String s) It'll not compile. The question is submitted with wrong answer
11th Jan 2020, 4:51 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 3
🇮🇳Omkar🕉 oh. Yes. I didn't observe that... The misspelled word. I checked it by executing after answering with parseInt() for clarity.. But not paid attention to parse(); int ommited. Typo error.. I think question is entered with spelling mistake... Thank for reply.. I retrieving my answer..
11th Jan 2020, 7:23 AM
Jayakrishna 🇮🇳
+ 2
Yes but that error occurs at compile time only so it answer must be compile time. Its stated wrong there as RuntimeException. Something like this is the exception in sololearn😂 🌟(Pro)metheus 🇸🇬
10th Jan 2020, 5:14 PM
Shubham kumar
Shubham kumar - avatar
+ 2
Already done 🇮🇳Omkar🕉 😇😇
10th Jan 2020, 5:31 PM
Shubham kumar
Shubham kumar - avatar
+ 2
Edit: compile error due to no such method parse(). If it is Integer.parseInt("12.7"); then it is run time Exception...
10th Jan 2020, 8:07 PM
Jayakrishna 🇮🇳
+ 2
JaggedArray yes. But read all posts here before giving some statement... If you read all, I hoping you will not say, same opinion..
11th Jan 2020, 4:08 PM
Jayakrishna 🇮🇳
+ 2
JaggedArray I mean about "so bad correct one has only 2 upvotes" right accepted true . But "wrong ans has 8 upvotes" is not to be pointed out.. And because actually there is no wrong answer... It is just miss read by us.. @Omkar pointed that. And explained about the question.. Rest you can see all edited answers accordingly with full acceptance.. .. Hoping you understand it...
11th Jan 2020, 6:01 PM
Jayakrishna 🇮🇳
+ 1
🌀Saroj Patel🌀🇮🇳 yes. Mi be vahi bol raha hu, in a soft way...
12th Jan 2020, 5:10 AM
Jayakrishna 🇮🇳