I know that Java doesn't support operator overloading, but I saw that you can assign value to an Integer object,for example, with the =
operator and not by using a setter.
So I was wondering is it possible to implement such behavior to any class?
I know that Java doesn't support operator overloading, but I saw that you can assign value to an Integer object,for example, with the =
operator and not by using a setter.
So I was wondering is it possible to implement such behavior to any class?
No. Those assignments only work on Java Primitive Wrappers (Integer, Long, etc) and String.