Is there a way to call a method in one class from another class. I could have say 5 classes and more than one may want to perform the same operation. So can I have one file (class??) with these common methods and call into that? If so what is the necessary modifier for these ‘common’ methods – public, final??
If anyone can point me to a suitable tutorial I would be grateful – in this instance I havent had much useful from Google
Thanks
Ron
This is a simple example for a (utility) class with a method that can be used from any other class:
To make it work “right out of the box”: choose public and static as access modifiers for the method. Just like all methods from the well known
java.lang.Mathclass.