It seems that the idea of package is necessary.
It seems easy to think of package = directory.
Put the main .java file in a folder.
Put this at the beginning of Test1.java
where main () is located
package test1;
Then, ** MyTest1Exception.java ** in the same layer can be read without importing anything.
void runSample() throws MyTest1Exception {
...
throw new MyTest1Exception("Unique exception");
HM
reference https://itsakura.com/java-dokuji-reigai
Recommended Posts