Create a class called EvenCount that contains a method called count that takes an integer as an argument and returns an integer (this method should not be declared static). The count method should use a recursive approach to find the amount of even digits in the integer passed into the method, and return this number. For example, if the count method was called with the input value 783312 as an argument it should return 2 (there are two even numbers in the input value). Hint: in Java a single digit that is even will produce a result of 0 when the remainder operator (the percent sign) is used to find its remainder when divided by two. For example 2 % 2 and 6 % 2 will return 0, whereas 3 % 2 and 7 % 2 will produce a result of 1.
package mocktest; public class EvenCount { public String count(String x) { if (x < 10 && x % 2 == 0) return 1; else if (x < 10 && % 2 !0) return 0; else if ((x >=10 && (x / 10 ) % 2 == 0) return 1 + count(x/10) + 1; else return count (x/10); } public static void main (String args[]); { EvenCount c = new EvenCount (); System.out.println(x.count(73221)); } }
Why do i have so many errors?