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
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 :)
+ 3
Shubham kumar , report that question by clicking on โ symbol at top right corner.
+ 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
+ 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..
+ 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 ๐ธ๐ฌ
+ 2
Already done ๐ฎ๐ณOmkar๐ ๐๐
+ 2
Edit: compile error due to no such method parse().
If it is Integer.parseInt("12.7"); then it is run time Exception...
+ 2
JaggedArray yes. But read all posts here before giving some statement...
If you read all, I hoping you will not say, same opinion..
+ 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...
+ 1
๐Saroj Patel๐๐ฎ๐ณ yes. Mi be vahi bol raha hu, in a soft way...