N
newbie_at_sendmail
Hi,
I'm quite new to java and I have huge problems doing something as simple as reading a file (up to end-of-file).
Can anybody please tell me what I'm doing wrong/is missing? I can't figure it out.
Thanks in advance.
package end_of_file;
import java.lang.String;
import java.io.File;
import java.util.Scanner;
import java.io.IOException;
import java.io.EOFException;
import static java.lang.System.out;
public class this_will_never_work
{
public static void main(String args[]) throws IOException
{
Scanner myScanner =
new Scanner(new File("c:\\temp\\this_will_never_work.txt"));
while (true)
{
try
{
String regel = myScanner.nextLine();
out.println("Gelezen regel= "+regel);
throw EOFException;
} catch (EOFException e) {out.println("Laatste regel gelezen");}
}
}
}
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
I'm quite new to java and I have huge problems doing something as simple as reading a file (up to end-of-file).
Can anybody please tell me what I'm doing wrong/is missing? I can't figure it out.
Thanks in advance.
package end_of_file;
import java.lang.String;
import java.io.File;
import java.util.Scanner;
import java.io.IOException;
import java.io.EOFException;
import static java.lang.System.out;
public class this_will_never_work
{
public static void main(String args[]) throws IOException
{
Scanner myScanner =
new Scanner(new File("c:\\temp\\this_will_never_work.txt"));
while (true)
{
try
{
String regel = myScanner.nextLine();
out.println("Gelezen regel= "+regel);
throw EOFException;
} catch (EOFException e) {out.println("Laatste regel gelezen");}
}
}
}
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-