It's quite hard to say what happened when you don't include the error message(s) you got when running the code with explicit package declarations.
It's hard to guess what went wrong - especially when the link in Google Drive is not readable. When you have an error related to package definition it may be that the source code is not placed into directories according to the package name.
Here I am using plain javac and
java - in real life a build tool such as
Maven should be used, but that's another story.
Code for class A in package
com.example should the be put into the directory
:
Then you can compile:
... and execute the class: