Lets say you have a class SomeClass
which has its own implementation of toString()
, and also has the ability to parse a new instance of itself by reading that same string.
Which of these methods do you prefer, or find better to use? You can either define it as another constructor:
public SomeClass(String serializedString);
or you can define it as a static method, which in turn creates a new instance (by one of the other constructors, does some with it, and returns the new instance:
public static SomeClass toObject(String serializedString);
Does it even matter? (my hunch is there is no case this matters, but I am trying to make sure)