It just exits the method at this point. After return executed, the rest of the code will not be executed.
eg.
public void test(int n) { if (n == 1) { return; } else if (n == 2) { doStuff(); return; } doOtherStuff(); }
Note that the compiler is smart enough to tell you that code cannot be reached:
if (n == 3) { return; youWillGetAnError();
CookieOfFortune Apr 13 '09 at 17:30 2009-04-13 17:30
source share