I have a very simple yes no question: should static methods have same result for every object?
No
public static boolean isEven(int number){
return (number %2 ==0);
}
What do you mean? Static methods can't have a this
object, but they might return different results if they're passed different arguments. In other words, a.staticMethod
and b.staticMethod
will certainly return the same results, but staticMethod(a)
and staticMethod(b)
could differ.