Very noob : Pls describe this code :P
Code:
import java.io.*;
import java.util.Scanner;
public class ScanXan {
public static void main(String[] args) throws IOException {
Scanner s = null;
try {
s = new Scanner(new BufferedReader(new FileReader("xanadu.txt")));
while (s.hasNext()) {
System.out.println(s.next());
}
} finally {
if (s != null) {
s.close();
}
}
}
}
I didn't understand what is hasNext() and what is next()
may be look too noob but hope i will get help.
:(sweat)::(-::=-::=(::s::(doh):
Re: Very noob : Pls describe this code :P
Have you read the API documentation for the Scanner class? Noone can do without the API documentation. Here it is: link.
kind regards,
Jos
Re: Very noob : Pls describe this code :P
Please go through the Forum Rules -- particularly the third paragraph.
db