Import files of the same hierarchy in Java

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.

image.png

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

Import files of the same hierarchy in Java
Get the result of POST in Java
The story of writing Java in Emacs
[Java] Handling of JavaBeans in the method chain
The story of making ordinary Othello in Java
About the idea of anonymous classes in Java
Measure the size of a folder in Java
Feel the passage of time even in Java
First touch of the Files class (or Java 8)
Code that deletes all files of the specified prefix in AWS S3 (Java)
Get the URL of the HTTP redirect destination in Java
[Java] Get the file in the jar regardless of the environment
Change the storage quality of JPEG images in Java
Summarize the additional elements of the Optional class in Java 9
Read binary files in Java 1
Import Excel data in Java
Implementation of gzip in java
Implementation of tri-tree in Java
Was done in the base year of the Java calendar week
A quick explanation of the five types of static in Java
Count the number of digits after the decimal point in Java
How to derive the last day of the month in Java
Access the network interface in Java
[Java] Delete the elements of List
Guess the character code in Java
Easily read text files in Java (Java 11 & Java 7)
[Java version] The story of serialization
Specify the java location in eclipse.ini
Unzip the zip file in Java
List of members added in Java 9
Parsing the COTOHA API in Java
Order of processing in the program
The origin of Java lambda expressions
Implementation of like function in Java
Call the super method in Java
Examine the system information of AWS Lambda operating environment in Java
[Java] Get the dates of the past Monday and Sunday in order
Output the difference between each field of two objects in Java
Find out the list of fonts available in AWS Lambda + Java
The milliseconds to set in /lib/calendars.properties of Java jre is UTC
Examine the list of timezone IDs available in the Java ZoneId class
Get the public URL of a private Flickr file in Java
Determine if the strings to be compared are the same in Java
Let's create a TODO application in Java 5 Switch the display of TODO
Overwrite upload of file with the same name with BOX SDK (java)
How to get the length of an audio file in java
How to increment the value of Map in one line in Java
[Java] I participated in ABC-188 of Atcorder.
Implementation of DBlayer in Java (RDB, MySQL)
Dynamically increase the number of elements in a Java 2D array (multidimensional array)
Check the contents of the Java certificate store
Specify the order in which configuration files and classes are loaded in Java
Automatically adjust the height of Xib files
Java reference to understand in the figure
Examine the memory usage of Java elements
The story of forgetting to close a file in Java and failing
[Java] Get the day of the specific day of the week
Try using the Stream API in Java
The identity of params [: id] in rails
Memo: [Java] Check the contents of the directory
I tried the new era in Java