Let’s say that I run a program I made that uses four different classes (denoted with public class ExampleClass1{*code inside*}
) in their own .java
files.
Do all four of these classes get stored in the Method Area of the Heap on start-up?
Or does only the class that with the main method that I ran get stored into the Heap on start-up and the other three classes wait to get stored, until they have code that needs to be run inside of them (i.e. object creation using their constructors, and using the object's methods)?