Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int i,n;
- Foglalas[] foglalasok;
- String[] temp;
- String delimiter = " ";
- try {
- olvas = new BufferedReader(new FileReader(pitypang));
- String be;
- n = Integer.parseInt(olvas.readLine());
- foglalasok = new Foglalas[n];
- for (i=0; i<n; i++) {
- foglalasok[i] = new Foglalas();
- }
- i=0;
- while ((be = olvas.readLine()) != null) {
- //szoveg.append(be).append(System.getProperty("line.separator"));
- temp=be.split(delimiter);
- foglalasok[i].sorszam = Integer.parseInt(temp[0]);
- foglalasok[i].szoba = Integer.parseInt(temp[1]);
- foglalasok[i].erk = Integer.parseInt(temp[2]);
- foglalasok[i].tav = Integer.parseInt(temp[3]);
- foglalasok[i].vendeg = Integer.parseInt(temp[4]);
- foglalasok[i].reggeli = Boolean.parseBoolean(temp[5]);
- foglalasok[i].nev = temp[6];
- i++;
- }
- }
- catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- finally {
- try {
- if (olvas != null) {olvas.close();}
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- }
- //LEGHOSSZABB TARTÓZKODÁS
- int[] tartam = new int[n]; <----- variable n might not have been initialized
Add Comment
Please, Sign In to add comment