Select from following answers:- Compile Successfully.
- Throw an error at compile time :- not all code paths return a value
- Throw an error at run time :- not all code paths return a value
- All Above
It will throw an error at compile time saying that :-
"not all code paths return a value". Meaning that once we create a function having return type then, it must be returned from function.
So,in above function return type is Integer,so we must return any Integer value from method then it will compile.
Show Correct Answer
Asked In: Many Interviews |
Alert Moderator