Nathan Kreider Nathan Kreider - 19 days ago 6
Java Question

Calling method without object

I have built a small (and 3 methods only!) api for myself, and I want to be able to call it like how you would call a method in Powerbot (A Runescape botting tool (I use it, but for programming purposes, not for actual cheating purposes)), without creating an Object of the file you'd require. How would i be able to do this?

Answer

if you use the static keyword when importing your class, you can use it's methods as if they belong to the class you're importing them to

http://docs.oracle.com/javase/1.5.0/docs/guide/language/static-import.html

and of course your "api methods" need to be static as well