I have made a class in Java which I would like to add, subtract, multiply and divide with integers. I know that I could make methods in that class such as add(int a), divide(int a) etc. and then return what I want, but then if I wanted to actually divide them, I would have to do this:
int a = 5;
myClass b = myClass.divide(a); //I have a divide method in that class which returns another instance of the same class
instead of just saying
int a = 5;
myClass b = myClass / a
I was wondering if there was any specific way to do it so I would be able to use it as shown in the latter example.