My code is becoming a scanner for some reason. When I run the code, it waits for input in the console, and when I enter anything, nothing happens, and it simply waits for more scanner input. I don't do anything with scanner, not even import it.
Here's the code.
import java.awt.Color; import java.util.ArrayList; public class Experiment { private Aviary av; private int[] results = new int[11]; public Experiment (Aviary x) { av =x; } public void printResults() { for(int i=0; i<=10; i++){ System.out.print(results[i]+" "); } System.out.println(); } public int howManyRed(ArrayList<Bird> x) { int count = 0; for(int i = 0; i<x.size(); i++) { if (x.get(i).getMyColor()==Color.red) { count++; } } return count; } public void runExperimentOnce() { results[howManyRed(av.see10Birds())]++; } public void runExperimentManyTimes(int w) { results = new int[11]; for(int i = 0; i<w; i++) { runExperimentOnce(); } double average=0; for (int i =0; i <10; i++) { average = average + (i * results[i]); } double weighted = 1.0 * average/w; System.out.println(weighted + " red birds out of " + 10); int slot = 0; int counter = 0; for(int i = 0; i<10; i++) { if (results[i]> counter){ slot = i; counter = results[i]; } } System.out.println("Highest category was " + counter + " with " + slot + " out of " + 1000000); } }