Referring to the FeedReaderContract
class on Android Developers page:
The code starts as:
public final class FeedReaderContract {
// To prevent someone from accidentally instantiating the contract class,
// give it an empty constructor.
public FeedReaderContract() {}
i.e. there is a default public
constructor for the class.
public
empty constructor prevent instantiation - should this maybe be private
?... am I still half asleep ? ...
PS I'm not concerned about the rest of the example, or how to use it. I am purely trying to confirm that I'm not going mad and stupid at the same time...
Self answer because this may help beginners?
The code comment is wrong. Empty constructor works fine.
To prevent instantiation, the constructor needs to be private
, not empty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With