cannot find symbol(test) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

5th Oct 2018, 11:56 PM
Reginald Tobias
Reginald Tobias - avatar
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)))
6th Oct 2018, 5:39 AM
Daniel (kabura)
Daniel (kabura) - avatar