I can not understand how to use the same function in several java classes. For example, I have the following function:
public int plus(int one, int two) {
return one + two;
}
How can I use that in several other files (classes)?
Should I create that in separate class?
If the implementation is always going to be the same (one+two), you could instead turn it into a static method, like this:
Then you can call the function like