Solution:
In Java, the keyword return used as a special and reserved keyword, not as a modifier. It is used at the end of any function with or without a value. Basically, it helps to exit a method.
As per your question, Yes, a void method can have a return statement as well as it can return a value. Let see:
public class MethodTest {
void myMethod(int x, int y){
int sum = 0;
sum = (x + y);
return sum;
}
public static void main(String[] args{
System.out.println(new MethodTest().myMethod(5,6));
}
}
Thanks.