'Import custom classes in java

I have a Main java class which has the main() method. In this method I want to use another class of that I wrote Person. Both classes are under the same package so I understand I don't need to import the Person class and I can use it right away.

Should I compile the Person class first and then the Main or not?

I tried to compile just the main and I got error:

cannot find symbol Person



Solution 1:[1]

My question is should I compile the Person class first and then the Main or not.

You could, but there is no need to do that given the simple requirements you describe. The 2 could be compiled together if you like. You do not necessarily need to compile Person first.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeff Scott Brown