I have a class structure roughly like this:
final public class Util { private Util() { throw new AssertionError(); // there is not supposed to exist an instance } public static DataElem getData() { return new Util().new DataElem(); } public class DataElem { // class definition } } The code for correctly generating an instance of the inner class was taken from this thread. But I didn't like that every time an inner class instance gets made, an instance from the outer one gets made first. And since I put the AssertionError into its constructor, it doesn't work.
Do I have to carry a dummy-instance around just to create instances from the inner class? Can't I make something like Util.DataElem work?
staticto the class header forDataElem?