A broken example
static void countUp(int n) {
if (n == 0) return; // base case never reached from a positive n going up
System.out.println(n);
countUp(n + 1); // BUG: moves away from 0, not toward it
}
countUp(3) prints 3, 4, 5, 6, ... forever and then crashes with a StackOverflowError. Changing n + 1 to n - 1 fixes it. (Because it never stops, this one is shown only as text — the runnable example below is a correct method.)