You have the following files:
main.java
mypackage/child.java
in main.java, the first line should be:
import mypackage.child;
from the directory where main.java is, run
javac mypackage/child.java
and then:
javac main.java
mypackage should contain child.java and child.class
java main should work, because it will look for child in a subdirectory called mypackage.