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

Rule:  Controversial5Checked automatically with code checker

Synopsis:Avoid assignments in operands
Language:Java
Severity Level:1
Category:Controversial


Description:
Avoid assignments in operands; this can make code more complicated and harder to read.
public class Foo {
 public void bar() {
  int x = 2;
  if ((x = getX()) == 3) {
   System.out.println("3!");
  }
 }
 private int getX() {
  return 3;
 }
}