there are some data sets (in 1C it would be called a collection) for example
1 мерин 25-05-20012 2 аудюха 17-06-2012 3 жигуль 22-06-2012
How can I pack this into an array (line by line of course) and how can I sort it out?
there are some data sets (in 1C it would be called a collection) for example
1 мерин 25-05-20012 2 аудюха 17-06-2012 3 жигуль 22-06-2012
How can I pack this into an array (line by line of course) and how can I sort it out?
To create for example a class, well, to access the fields, you must also add getters and setters
class Record { private int number; private String name,date; public Record(String token) { String[] data = token.split(" "); this.number = Integer.parseInt(data[0]); this.name = data[1]; this.date = data[2]; } }
Then create
List<Record> list = new ArrayList<Record>();
add
list.add(new Record(inputString));
Walk on it
for (Record record : list) { ... }
A two-dimensional array in this case is 3 by 3, using a for loop
Source: https://ru.stackoverflow.com/questions/107686/
All Articles