I have a jar file : "CallMeMaybe.jar".
There is a static method callMe() in the main class callmemaybe.CallMeMaybe . Like it is possible to call the main() method from command line by running :
java -cp CallMeMaybe.jar callmemaybe.CallMeMaybe
Is there a way to directly call another static method than main() ?
I would like to do that :
java -cp CallMeMaybe.jar callmemaybe.CallMeMaybe.callMe()
You can't call it directly, but just call it from your main method i.e.
public class Foo {
public static void main(String[] args) {
doSomething(args);
}
private static void doSomething(String[] args) {
// your code here
}
}
Although I don't see the point of the extra method.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments