Hello.. i would like to ask you. Its long time i did something in java.. and now I am lost. :)
I have text file with constant elements in line but variable number of lines... text file looks like
asdf 12 54 12
brjk 45 2 14
etc..
I want to make array from this file. Can you help me with my code? This not working..
all comments are appreciated..
I have text file with constant elements in line but variable number of lines... text file looks like
asdf 12 54 12
brjk 45 2 14
etc..
I want to make array from this file. Can you help me with my code? This not working..
Code:
String[] part = new String[5];
BufferedReader f = null;
try{
f = new BufferedReader(new FileReader(filename));
String something=null;
while((something=f.readLine())!=null){
part = something.split(" ");
System.out.print(part[0]);
}
} catch (IOException ex) {
Logger.getLogger(Hlavni.class.getName()).log(Level.SEVERE, null, ex);
}
all comments are appreciated..
Comment