I'm making an abstract Font
class and I want to force subclasses to declare a constructor that takes a single int
parameter (font size). I tried doing so as follows.
public abstract class Font {
...
public abstract Font(int size);
...
}
But my compiler declares:
Error:(20, 19) java: <path omitted>/Font.java:20: modifier abstract not allowed here
This isn't exactly the end of the world - this isn't strictly necessary, I just wanted the Java compiler to force me to remember to implement that constructor. I just wonder why this isn't allowed?