is there a way to declare 2 classes on the same .java file using Eclipse – also how the compiler will distinguish the .class for each declare class.
example
public class ThisTest
{
public static void main(String[] args)
{
}
}
class SimpleArray
{
}
thank you for your time.
Yes, exactly like your example.
The extra class need to be non-public
You could also define inner/nested classes. In this case you should investigate the difference
Java inner class and static nested class
Each class will be located in an own .class file in a directory similar to the package.
Nested classes get its host prefixed and separated by an ‘$’.
The above case results in four class files
Just check the bin or classes folder of your eclipse project.