package a; public class Class1 { public static void main(String[] args) { Class2 class2 = Class2.getInstance(); System.out.println(class2.getWertC2()); class2.setWertC2("Wesseling"); System.out.println(class2.getWertC2()); } } class Class2 { /**constructor */ private Class2() { } private String wertC2 = "Bonn"; /** aufgerufene Methode */ public static Class2 getInstance() { return new Class2(); } public static void main(String[] args) { } /** * @return */ public String getWertC2() { return wertC2; } /** * @param string */ public void setWertC2(String string) { wertC2 = string; } }