r/learnjava • u/[deleted] • Dec 08 '17
Calling methods of a different class query
Hi guys.
Say I have a method in class A.
I then wish to call the method from class A in public static void main(String[] args).
How would I do so?
0
Upvotes
3
u/empire539 Dec 08 '17
If the method is non-static, then you probably will need to instantiate an A object first, e.g.
Otherwise, if the method is static, you should be able to call it directly on A:
A.myStaticMethod().