Wrote the code right but getting ExampleProgram.java: error: missing return statement } ^ 1 error in commant prompt what to do? | Sololearn: Learn to code for FREE!
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

18th Aug 2016, 8:13 PM
Chahat Gupta
Chahat Gupta - avatar
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
18th Aug 2016, 8:38 PM
WPimpong
WPimpong - avatar
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.
18th Aug 2016, 10:15 PM
James
James - avatar