[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.