java - Loop invariant for repeated calls to readLine() -
I have a time loop (shown below) that reads continuously with a file until it reaches the EOF is. I should write a loop irreversible for any non-trivial loop. Is this a trivial loop? If not, what would be a loop unchanging for this loop? I have never written anything irreversible before.
while (line! = Null) {System.out.println (line); Line = reader. Readline (); } You can use a fileReader: while ((line = fileReader.hasNextLine ()) = faucet {string line = fileReader.nextLine (); Println (line); }
= D
Comments
Post a Comment