How to use the same function in several java classes? -


i can not understand how use same function in several java classes. example, have following function:

public int plus(int one, int two) {   return 1 + two; } 

how can use in several other files (classes)? should create in separate class?

if implementation going same (one+two), instead turn static method, this:

class util{     public static int plus(int one, int two) {         return 1 + two;     } } 

then can call function

int result = util.plus(1,1) 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -