You can only put one top level class in a source file, so you can't really put a superclass and subclass in the same file. (Well, maybe you could, but not in the beginner forum
.) This one-class-one-file rule makes life easier for the compiler and humans who go looking for source code.
I think you could extend a public class into a package level class. Give it a try and see.
Then try making a method public in the superclass and overriding it to be private in the subclass. See what happens and whether it makes sense.
Keep coding, keep asking, keep having fun!