I have this code here and it makes sense to me that it would print out how many instances occur in the array of the element at array[i]. The count never goes above one, what am I doing wrong?
import java.util.Scanner;
public class poker
{
public static void main(String [] args)
{
Scanner scan = new Scanner(System.in);
String[] array = new String[5];
for(int i = 0; i < array.length; i++)
{
array[i] = scan.nextLine();
}
for (int i = 0; i < array.length; i++) {
int count = 0;
for (int j = 0; j < array.length; j++) {
{
if (array[i] == array[j]) {
count++;
}
}
if (count >= 3) {
System.out.println(array[i] + " exists " + count + " times.");
}
}
}
}
}