Hi. So my problem is that my loop doesn't stop.
Here's my code.
public void askData ()
{
String word;
String stop = null;
int line = 0;
File dataInput = new File ("dataIn.text");
c.println ("In order to stop, just leave it blank.");
c.println ();
while (true)
{
try
{
FileWriter data = new FileWriter (dataInput);
c.print ("Enter word " + (line + 1) + ": ");
word = c.readString ();
data.write (word);
data.close ();
line++;
if (word.equals (stop))
{
displayData ();
}
}
catch (IOException e)
{
new Message ("Error");
}
}
}
Basically what I want is that it calls displayData method when the user doesn't input anything and just press enter.
Here's the code for the dsiplayData.. It's basically for testing to see that it works.
public void displayData ()
{
c.print ("It works");
}