Answer the question
In order to leave comments, you need to log in
How to perform an operation on operands of unknown types?
For example, take the + operation.
Need a feature like this: Object plus(Object left, Object right) {...}
What:
plus(1, 3); // = 4 (Integer)
plus(1L, 3); // = 4 (Long)
plus(1L, "test"); // = "1test" (String)
plus(1, new Date()); // Exception
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question