Counting number of eights
Another approach is to let the recursive method know if the previous digit was an eight.

public int count8(int n) {
  return count8(n,false)
}

public int count8(int n, boolean lastDigitWasMatch) {
  if(n == 0) {
    return 0;
  } else {

    boolean match = (n % 10 == 8);
    int count = match?(lastDigitWasMatch?2:1):0;
    return count+count8(n/10,match);
  }
}