Import a custom class in Java

Total
0
Shares

How do I import a class I wrote in a different file? All my classes are under the same package.


Solution

If all of your classes are in the same package, you shouldn’t need to import them.

Simply instantiate the object like so:

CustomObject myObject = new CustomObject();

Source: StackOverflow.com

Leave a Reply

Your email address will not be published. Required fields are marked *