If you want to call the main method of another class you can do it this way assuming I understand the question.
public class MyClass {
public static void main(String[] args) {
System.out.println("main() method of MyClass");
OtherClass obj = new OtherClass();
}
}
class OtherClass {
public OtherClass() {
// Call the main() method of MyClass
String[] arguments = new String[] {"123"};
MyClass.main(arguments);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…