class AdressElement { private String name; private String strasse; private String ort; private final int anzahlFelder; private final String[] felder; public AdressElement () { this.name = ""; this.strasse = ""; this.ort = ""; this.anzahlFelder = 3; this.felder= new String[this.anzahlFelder]; this.felder[0] = "Name"; this.felder[1] = "Strasse"; this.felder[2] = "Ort"; } public void dummy1 () { this.felder[0] = "Vorname Name"; // this.anzahlFelder = 3; // this.felder = new String [17]; } public void dummy2 () { char ca1[]= {'h','a','l','l','o'}; System.out.println(ca1[0]); { char ca2[]= ca1; ca2[0]= 'X'; System.out.println(ca1[0]); } } public void setzeAdresse (String name, String strasse, String ort) { this.name = name; this.strasse = strasse; this.ort = ort; } public void liesAnzahlFelder (int anzahlFelder) { anzahlFelder = this.anzahlFelder; } public void liesAdresse (String name, String strasse, String ort) { name = this.name; strasse = this.strasse; ort = this.ort; } public static void zeigeFelder () { System.out.println ("Name\nStrasse\nOrt\n"); // for (int i = 0; i < anzahlFelder; i++) { // System.out.println (felder[i]); // } } public String toString() { String s = name + "\n" + strasse + "\n" + ort + "\n"; return s; } } public class AdressenListe { public static void main (String[] args) { AdressElement a = new AdressElement (); a.zeigeFelder (); } }