import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Example4_4 {
private void doInputs(final String fileName) {
final FileInput in = new FileInput(fileName);
Scanner in2 = in.getFileInputScannerObject();
final int n = in2.nextInt();
System.out.println("Integer was: " + n);
final long l = in2.nextLong();
System.out.println("Long was: " + l);
final float f = in2.nextFloat();
System.out.println("Float was: " + f);
final double d = in2.nextDouble();
System.out.println("Double was: " + d);
final char c = in2.nextChar();
System.out.println("Char was: " + c);
final String s = in2.nextLine();
System.out.println("Line was: " + n);
in2.close();
}
public static void main(final String[] args) {
Example4_4 object = new Example4_4();
object.doInputs("test_data.txt");
}
}
error message:
cannot find symbol - method nextChar()
This post has been edited by litterbug_kid: 28 January 2009 - 06:46 AM

New Topic/Question
Reply




MultiQuote






|