I have two java classes (.java files). I want to be able to create new instances of an object in one class that were defined in the other class, without referencing the class name each time. In C# there are
import <pre-compiled code>
TestFunction is a static method in
TestClass, you can use a static import:
import static TestClass.TestFunction; // or import static TestClass.*;
and then call it without using the class qualifier:
Note this can lead to confusing/hard-to-read code – use static imports sparingly.