Computer Science, asked by Shambhavi012, 1 month ago

Question☝️I need the value of a,b​

Attachments:

Answers

Answered by Oreki
10

\text{\bf\large Given Snippet}

    \texttt{if (a > b)}\\\texttt{\hspace{1em} a++;}\\\texttt{System.out.println("a = " + a)};

 \text{ \textbf{Case 1}}

      \texttt{Where, a = 5 and b = 6.}

           \texttt{if (5 > 6) // false }\\\texttt{\hspace{1em} a++; // Won't execute and $a$ remains the same.}\\\texttt{System.out.println("a = " + a)};

     {{\it O utput : } \: \texttt{a = 5}}

 \text{ \textbf{Case 2}}

      \texttt{Where, a = 6 and b = 4.}

            \texttt{if (6 > 4) // true }\\\texttt{\hspace{1em} a++; // Will execute and increment $a$ by 1.}\\\texttt{System.out.println("a = " + a)};

      {{\it O utput : } \: \texttt{a = 7}}

Similar questions