New course! Every coder should learn Generative AI!
Try a free lesson- 1
Wrote the code right but getting ExampleProgram.java: error: missing return statement } ^ 1 error in commant prompt what to do?
Getting error: missing return statement
2 Answers
0
To fix,
1 copy your code to another file. you may use notepad.
2 remove all lines of code from class body
e.g. so the remain
public class ExamplePrgram{
}
3 compile your program
4 if fail, fix code util pass
5 copy the code from backup file in 1 into class body. do this method by method, or some of lines,
6 do 3, 4, 5 again util finish
0
Sounds like you created a method that wasn't void so it's asking you to return something and you didn't set a return value. Either add void to the method calling or copy/paste your code here so we can debug it properly.