combining .java files

i have 3 .java files that make up an application. DrawJPanel.java Elevator.java and MyRectangle.java.............i would like to put DrawJPanel.java and MyRectangle.java into Elevator.java.....and i'm not quite sure how that works......help would be appreciated
[269 byte] By [justaregulara] at [2007-10-2 18:32:25]
# 1

> i have 3 .java files that make up an application.

> DrawJPanel.java Elevator.java and

> MyRectangle.java.............i would like to put

> DrawJPanel.java and MyRectangle.java into

> Elevator.java.....and i'm not quite sure how that

> works......help would be appreciated

What do you mean by "putting source files into other source files"? What are you trying to accomplish exactly?

Lokoa at 2007-7-13 19:53:58 > top of Java-index,Other Topics,Algorithms...
# 2

inner classes allow you to put multiple classes into a single file thusly

class Elevator{

static class DrawPanel{

} // end class DrawPanel

static class MyRectangle{

} // end class MyRectangle

} // end class Elevator

Doing it this way means that the actual name of the DrawPanel class is not really DrawPanel, it is Elevator.DrawPanel. Other than that things are pretty much as you would expect.

When you start using inner classes you begin to cross into religious territory and risk violating some deeply held belief systems. But there are those of us that believe that whatever you choose to do in the privacy of your own home with your own compiler is really none of our business, at least as long as the compiler consents, of course.

Enjoy.

marlin314a at 2007-7-13 19:53:58 > top of Java-index,Other Topics,Algorithms...
# 3
Whereas public classes are expected in a file with the base name equalling to that of the class, not public one are freely placed. So if there is at most one public class, and they all are in the same package, you can place them into one source file.
BIJ001a at 2007-7-13 19:53:58 > top of Java-index,Other Topics,Algorithms...