Missing return statement | Sololearn: Learn to code for FREE!

0

Missing return statement

https://code.sololearn.com/cZRKYp43ByUp/?ref=app The code checks if a string is 'prime' Line 52 missing return statement. But i do have one return statement within the function scope.

7/31/2018 2:18:02 PM

Ahan

3 Answers

New Answer

0

Yeah, if flag is 1, but if it isn't? there's no return, you gotta cover al possible options

0

Thank you for your help. But still my code is flawed and i cant comprehend the error. Could you help me out again? i tried looking up nullpointerexception on the Internet but couldn't understand a thing

0

the problem id at line 33. What happens is that, the code inside classes is executed when you run the.program, even if you don't create am object, so you assign l the length of str, but str hasn't been initialized. this has 2 solutions(maybe more). You initialize Stringop variables with some value or, you assign l the length inside the method stringprime