If a local variable is declared but not used in the program, it can be considered dead code and should therefore be removed. This will improve maintainability because developers will not wonder what the variable is used for.
public int compute(int a){ int foo = 6; return a * 4; }
public int compute(int a){ return a * 4; }