From e6f5703d8ce964f76a3471db1a72cb1aaafeb2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=B6rner?= <3012330@stud.hs-mannheim.de> Date: Tue, 16 Jan 2024 13:19:57 +0100 Subject: [PATCH] UI hat kein Zugriff mehr auf wichtige Daten (BankkontenListe) --- Banksystem/src/bank/Bank.java | 11 +++++++++-- Banksystem/src/bank/BankUI.java | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Banksystem/src/bank/Bank.java b/Banksystem/src/bank/Bank.java index ab64b94..d9ffc8e 100644 --- a/Banksystem/src/bank/Bank.java +++ b/Banksystem/src/bank/Bank.java @@ -44,8 +44,15 @@ public class Bank implements Serializable { return null; } - public ArrayList getKontenListe() { - return kontenliste; + //public ArrayList getKontenListe() { + public String[] getKontenListe() { + String kontendaten[] = new String[kontenliste.size()]; + + for (int i = 0; i < kontendaten.length; i++) { + kontendaten[i] = kontenliste.get(i).toString(); + } + + return kontendaten; } @Override diff --git a/Banksystem/src/bank/BankUI.java b/Banksystem/src/bank/BankUI.java index 0c3a5f0..03e8868 100644 --- a/Banksystem/src/bank/BankUI.java +++ b/Banksystem/src/bank/BankUI.java @@ -43,7 +43,7 @@ public class BankUI { private static void kontenListeanzeigen() { System.out.println("Hier sind die Konten: "); - for (Bankkonto b:bank.getKontenListe()) { + for (String b:bank.getKontenListe()) { System.out.println(b); } }