Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.

Paste

Pasted as Plain Text by Collins ( 11 years ago )
public DataList(String filename) {
  File file = new File(filename);
  Scanner sc = null;
  try {
   sc = new Scanner(file);
  } catch (FileNotFoundException f) {
   System.out.println("Datei " + file + " nicht vorhanden");
  }
  while (sc.hasNextLine()) {
   String line = sc.nextLine();
   line = line.trim();// Leerzeichen am Anfang und Ende entfernen
   if (line.charAt(0) == '%') {
    continue;
   }
   int zahl = Integer.parseInt(line);
  }
  sc.close();
 }

 

Revise this Paste

Parent: 59815
Your Name: Code Language: