Will the following code compile successfully?
 
private int GetID (string inputText) 
{
    if (inputText != "")
         return 1;
  else if (inputText == "")
        return 0;

 }
 
Explanation
Even though it may seem that all the options are considered, it is necessary that there is either an unconditional return at the end of the method or an else block in a nested if block. It turns out that formally not all the blocks are present in the code (although all of them are considered logically).

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback