JAVA } Error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JAVA } Error

why does this code return an error? https://code.sololearn.com/ceRnwFcsG9wV/?ref=app

23rd Apr 2019, 3:33 AM
koala 🐨
koala 🐨 - avatar
1 Answer
+ 1
Your method public static boolean div(int num) has return type "boolean" compiler expect that this method will have a "return " statment and it will return some boolean value. You need to replace boolean to void in method declaration if you dont want to return anything. Or return "lab" at the end of the method.
23rd Apr 2019, 5:44 AM
Dima Makieiev
Dima Makieiev - avatar