Wrong answer?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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
10 Answers
+ 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 ๐Ÿ‡ฎ๐Ÿ‡ณ