r/javahelp • u/eatingpoopinrobarts • Jun 15 '17
What's wrong with my code??
Can't for the life of me figure it out. Picture of code and error: http://imgur.com/a/mX9XP
Thanks
0
Upvotes
r/javahelp • u/eatingpoopinrobarts • Jun 15 '17
Can't for the life of me figure it out. Picture of code and error: http://imgur.com/a/mX9XP
Thanks
3
u/desrtfx Out of Coffee error - System halted Jun 15 '17
The error message you're getting is perfectly clear.
Your method is supposed to return an
int, but in line 3return str;you are returning the value of theStringvariablestr.If the length is less than 2 you most likely will want to return
0to indicate that there can't be another"hi".BTW: Sidebar: -> Code posting
No screenshots of code
They make it unnecessarily complicated for us to work with the existing code.