Integer myInt = new Integer(10);
System.out.println(myInt);
This would give me back 10. But how? Every time I print out for example a custom Number object, which has a value, or any other object I get back something like: com.example.CustomNumber@14ae5a6
How can I achieve, to get the value as a number? Shall I Override something? I get it how it works with Strings, I'd simply override the toString method, but how does it work with numbers?