also ich muss die quellcode am montag der Klasse vorstellen kann mir mal einer helfen:(
kann mir mal jemand erklären was in jeder zeile abläuft bis zeile 8 lässt es sich selber erklären und manche stellen hab ich selber versucht ich hoffe es ist richtig bin auf jede kleinste hilfe dankbar. . .
1package Kontooo;
2
3import java.io.*;
4
5public class konten {
6 private int kontostand;
7 private int grenzwert;
8 private int kontoname;
9
10 public konten(int kontoname){
11 try{
12 this.kontoname=kontoname;
13 File f = new File("C:\\Users\\Nurullah\\Desktop\\Konto"+kontoname+".txt");
14 FileReader fr = new FileReader(f);
15 char [] temp = new char[(int)f.length()];
16 fr.read(temp); // die daten werden eingelesen und ins char array geschrieben
17 String les = new String(temp);// array zum String
18 String[]werte=les.split(" ");// String zum String array
19 this.kontostand=Integer.parseInt(werte[0]);//array ausgelensen
20 this.grenzwert=Integer.parseInt(werte[1]);// array ausgelsen
21 fr.close();
22
23 }catch(FileNotFoundException e){// um fehler abzufangen
24
25 e.printStackTrace();
26 }catch(IOException e){
27 e.printStackTrace();
28 }catch(NumberFormatException e){
29 e.printStackTrace();
30 }
31
32 }
33
34 public void setKontodaten(int kontostand,int grenzwert) {
35 this.grenzwert=grenzwert;
36 this.kontostand = kontostand;
37 try{
38 File f = new File("C:\\Users\\Nurullah\\Desktop\\Konto"+kontoname+".txt");
39 FileWriter fw = new FileWriter(f);
40 String daten=kontostand+" "+grenzwert;//daten werden geschrieben
41 char[] buffer = daten.toCharArray();// daten zum char array
42
43 fw.write(buffer);
44 fw.close();
45 }catch(IOException e){
46 e.printStackTrace();
47 }
48 }
49
50 public int getKontostand() {
51 return kontostand;
52 }
53 public int getGrenzwert() {
54 return grenzwert;
55 }
56
57 public int getKontoname() {
58 return kontoname;
59 }
60
61}
62