“Missing return statement” within if / for / while

I have a question regarding return statements used within if() while() or for() statements.
As you can see in the following method, it is expecting that I return a String value.
The problem is that if i where to use a return within my if statement block, the compiler would return the error missing return statement.

public String myMethod()
{
    if(condition)
    {
       return x;
    }
}

Of course I could change the method header to void and use System.out.println instead of return. But is this the right way to do it? am i missing something?

Any help is highly appreciated.