In C++ I'm able to do something like this
(some_condition)? function1():function2();
When i tried the same thing in Java it's not possible. It wants some variable to hold the result even though the return type of function1 and function2 are void.
Is there any other way to do it other than if... else...?