From what I have gathered, I want to force a class to use particular private fields (and methods) I need an abstract class because an interface only declares public/static/final fields and methods. Correct??
I just started my first big java project and want to make sure I'm not going to hurt myself later :)
It's fairly common to provide both, so that you end up with:
and
That way, anyone who is happy with the default implementation in the abstract class can quickly subclass it without rewriting a lot of code, but anyone who needs to do something more complex (or who needs to inherit from a different base class) can still implement the interface and be plug-and-play.
If you want a class to use certain fields or methods of another class, you could declare them as protected.
can be accessed by another class in the same package (could be extending class A, or not)
It's not really "forcing" another class to use it though, more like "enabling".
Private fields and methods cannot be used by subclasses (except if they are also inner classes). You could make them protected, however.
If you ever find yourself guessing which one to choose I's suggest to err on the side of Interfaces - It's better to have an interface that should have been an abstract class than the other way around.
This is correct. But it is not necessarily an either-or decision, you can combine the advantages of interfaces and abstract classes by providing a skeletal implementation along with your interface. You can find a very interesting description of this approach in Effective Java, 2nd Ed., Item 18 ("Prefer interfaces to abstract classes").
This part of your question is questionable: why do you think you want to do this?
private members are not visible to subclasses, and interfaces define the public interface, so your only choice would be to use an abstract class...but I cannot think of any reason why anyone would ever want to do this