Empty constructor in FeedReaderContract demo

android, java

Solution

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.

Problem

Referring to the `FeedReaderContract` class on Android Developers page: - Saving Data in SQL Databases 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. - Is that code comment correct? - How does a `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...

Original source