How to break this while(true) loop?
问题 Hi I am trying to break from this loop and return the coordinates when both if statements are true. However the loop is never ending. How can I fix it? public static String[] positionQuery(int dim, Scanner test_in) { Scanner scanner = new Scanner(System.in); System.out.println("Provide origin and destination coordinates."); System.out.println("Enter two positions between A1-H8:"); while(true) { String line = scanner.nextLine(); String[] coordinates = line.split(" "); if(coordinates.length ==