In Java there is no operator overriding like i C++ so I can\'t figure out how to implement a boxing/unboxing for my own class.
For example it\'s possibile to use box
autoBoxing or unboxing is available only with primitive in java
like Long
wrapper class for long
Integer for int
but user defiend not possible,
best you can do constructor initialize like
Myclass m=new Myclass(100);
There is no way to implement auto-boxing and auto-unboxing for a user-defined class.
You can of course provide named methods to do the job. However, you would have to call them explicitly every time you need to box or unbox something.
It's not possible to implement automatic boxing and unboxing for your own class - auto(un)boxing is a language feature, implemented in the Java compiler.