import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
public class FindDuplicates {
public static void main(String[] args)
{
String StringLetters = "aaabbbccc";
List<String> NewList = new ArrayList<String>(Arrays.asList(StringLetters.split(",")));
// System.out.print(NewList);
// System.out.print(NewList.size());
char CharA = 'a';
int count = 0;
for(int i = 0; i < NewList.size(); i++);{
if (NewList.indexOf(i) == CharA);{
System.out.print(i);
}
}
}
}
Im building a program that counts duplicate values in a Java string. However, I receive "i cannot be resolved to a variable" even though its initialized within the for loop? Any guidance is appreciated.