I have the following method that returns void and I need to use it in another method that also returns void. Can I do the following?
public void doSomething(){}
public void myMethod()
{
return doSomething();
}
Thanks for all your comments, but let me be more specific
I only doSomething
if something happens, otherwise I do other things
public void doSomething(){}
public void myMethod()
{
for(...)
if(somethingHappens)
{
doSomething();
return;
}
doOtherStuff();
}
Instead of the code above, can I just write return doSomething();
inside the if statement?