Wrong answer?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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 šŸ‡®šŸ‡³