I was also facing this error and thought it was my own IDE's fault, but then I discovered I did something silly . I have put the return inside a Void subroutine. You can't use return in a Void as it is a subroutine and subroutines don't return any value.
So, we all learned that we need to learn and practice Java and understand programming concepts Thank you!
P.S. I apologize for bumping this topic.
P.S.2. Anyone can close this topic.