I was wondering if there is any benefit of this
public static main(String[] args)
{
Main mainInstance = new Main();
mainInstance.Foo();
}
public void Foo() {}
over this
public static main(String[] args)
{
Foo();
}
public static void Foo() {}
The one am used to is the second example, but I came across a piece of code that's like the first example, and am curious to know if it has any benefits over the other
Foo
actually does, but if it uses any of the data stored inside instances of the class, then it will need to be an instance method.