[JAVA] Loop double printing, canāt find the problem - HELP PLS
Long story short, I have made an application to order movie tickets. In some places the console is double printing things, and I cannot find the error. Thereās two problems but to make this less cluttered Iāll focus on the first. āfilmsā refers to an array containing different movie titles. ānumberSelectionā is for the user to input which movie theyād like to select based on the array. /////////////////////////////////////////////////////////// private static Film filmSelection() { int numberSelection: System.out.println(āWhich film would you like to watch:ā); for(int i=1;i<films.length;i++) { System.out.println(i + ā ā + films[i]); } numberSelection = scan.nextInt(); if(numberSelection >= 1 && numberSelection <= 4){ return films[numberSelection]; } else { return null } } /////////////////////////////////////////////////////////// The current console output is the print statement is: 1 MovieTitleHere 2 MovieTitleHere 3 MovieTitleHere 4 MovieTitleHere (Scanner input here) 1 MovieTitleHere 2 MovieTitleHere 3 MovieTitleHere 4 MovieTitleHere (Scanner input here *notice how it duplicates *the duplication doesnāt show until the first scanner input has been entered.