java - Jumping pair lines using .readLine() method at a while loop -
i new @ java , having little trouble:
i trying read chemical samples represent them @ x-y graph.
the input file looks this:
la 0.85678
ce 0.473
pr 62.839 ... ...
my code stocks unpair lines value (0.85678, jumps line, 62.839 @ example), , cannot realize problem:
public class procces { public void readree() throws ioexception { try{ ree = new bufferedreader (new filereader ("src/files/test.txt")); while ( (currentline = ree.readline() ) != null) { try { (int size = 3;size<10;size++) { string valuedec=(currentline.substring(3,size)); //char letra =(char)c; if ((c=ree.read()) != -1) { system.out.println("max size"); } else valued = double.parsedouble(valuedec); system.out.println(valuedec); } } catch (exception excuncertaindecimals) { } } }finally { try { ree.close(); } catch (exception exc) { } } } string line; int c = 0; int counter = 0; string values = null; string valuesimb = null; double valued = null; double logvalue = null; double yfin=450.0; string currentline; bufferedreader ree;
}
thank in advance, can't see why program jumps pair lines.
use java scanner class.
import java.io.*; import java.util.scanner; public class myclass { public static void main(string[] args) throws ioexception { try (scanner s = new scanner(new bufferedreader(new filereader("file.txt"))){ while (s.hasnext()) { system.out.println(s.next()); } } } }
Comments
Post a Comment