package Lernen; import java.beans.XMLEncoder; import java.io.FileOutputStream; import java.io.IOException; import Testat1.Tutor_Aufgaben.Clone.Alien; import Testat1.Tutor_Aufgaben.Clone.Raumanzug; public class ObjectInputOutputStreamEx { public static void main(String[] args) { String DateiName = "test1.txt"; Alien a1 = new Alien ("sfei", new Raumanzug()); Alien a2 = a1; Raumanzug r1 = a1.getAnzug(); try (XMLEncoder output = new XMLEncoder(new FileOutputStream(DateiName))){ output.writeObject(a1); } catch (IOException e) { e.printStackTrace(); } } }