Computer Science, asked by masternavya, 7 months ago

. What will be the output-
int k = 10, j = 5:
K++
If(k==11)
{
System.out.println("Execute Ist" );
}
Else
{
System.out.println("Execute 2nd ");
} ​

Answers

Answered by anindyaadhikari13
2

Question:-

Write the output of the following code.

Solution:-

Given code,

int k=10,j=5

k++;

if(k==11)

{

System.out.println("Execute 1st.");

}

else

{

System.out.println("Execute Second. ");

}

Here,

k=10

k++; (now, k becomes 11)

So, k==11 is true.

if block will execute.

Output:-

Execute 1st.

Output:-

Execute 1st.

Similar questions