It will throw an error at Compile-time saying that:-
"Since '_Default.sum(int, int)' returns void, a return keyword must not be followed by an object expression".
So meaning that,if we are creating any function,that returns void means void does not return anything.So we must not return any value from inside function or method.
So we have to remove "return a + b;" from above function.
Asked In: Many Interviews |