TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  Controversial3Checked automatically with code checker

This rule is Obsolete
Synopsis:A method should have only one exit point, and that should be the last statement in the method
Language:Java
Severity Level:6
Category:Controversial


Description:
A method should have only one exit point, and that should be the last statement in the method.
public class OneReturnOnly1 {
  public void foo(int x) {
   if (x > 0) {
    return "hey";   // oops, multiple exit points!
   }
   return "hi";
  }
 }