hi guys, I am having trouble with this code, cause i get an infinite loop. I made nexTxtFile the variable name of the txt file i am creating and writing text to. i want to be able to get user input untill the user does not want to enter anymore text but i don't know how to do that. i used while (scan.hasNext()) but that just loops to infinity. Without the while loop i just get only the first word i type in as user input, how can i fix this? may i please have an example?
File myFile = new File(newTxtFile);
Writer output = new BufferedWriter(new FileWriter(myFile));
while (scan.hasNext()) {
txt = scan.next ();
output.write(txt);
}
output.close();
thanks ippoMarley:)