import java.io.*;
import java.util.*;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class Location{ String location;
String id;
public static void main(String args[]) {
ArrayList<Location> locationlist = new ArrayList<Location>(50);
int i,i2,i3;
String[] theword = null;
try {
FileReader fr = new FileReader("myfile.txt");
BufferedReader br = new BufferedReader(fr);
String line = "";
while ((line = br.readLine()) != null) {
String[] theline = line.split(" | ");
for (i = 0; i < theline.length; i++) {
theword = theline[i].split(" ");
Location locations = new Location();
for (i2 = 0; i2 < theword.length; i2++) {
locations.location = theword[i2];
//locations.id = theword[i2+1];
locationlist.add(locations);
System.out.println("The content of arraylist is: " + locations.location);
}
} //System.out.println("The content of arraylist is: " + locations.location);
//System.out.println("The content of arraylist is: " + locations.id);
}//System.out.println("The content of arraylist is: " + locationlist);
}
catch (IOException ex) {
System.out.println("Could not read from file");
}
}
}
1 Replies - 92 Views - Last Post: 08 October 2012 - 05:06 PM
#1
I need the read data directly to combox in 2d array
Posted 08 October 2012 - 05:02 PM
Replies To: I need the read data directly to combox in 2d array
#2
Re: I need the read data directly to combox in 2d array
Posted 08 October 2012 - 05:06 PM
Go read the rules of the forum, then you might receive a bit of help. As things stand, your breaking atleast 5 rules.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|