0
cannot find symbol(test)
public class CountYZ{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); int count = 0; char test; String word; System.out.print("Enter a word: "); word = sc.nextLine(); word = word.toLowerCase(); int len = word.length(); for(int ctr = 0; ctr < len; ctr++){ if(word.charAt(ctr) == 'y' || word.charAt(ctr) == 'z'){ if(ctr < len - 1 && !test(word.charAt(ctr +1))) count++; }else if(ctr == len - 1) count++; } System.out.print(count); } } // cannot find symbol: test
1 Answer
- 1
Paste code to playgraund....
Change test char to string
What do you want to get with this piece of code
if(ctr < len - 1 && !test(word.charAt(ctr +1)))