Computer Science, asked by bollywoodmusic64, 7 months ago

what will be the output of the following code
int a=10,b=20;
if(a<b)
a=100;
b=200;
system.out.print(a+" "+b);​

Answers

Answered by PrivateMentor
0

Explanation:

First of all your if statement is wrong as without brackets java will consider only the first statement after the if statement, i.e. a=100 as a part of if. so the coding must be:

int a=10,b=20;

if(a<b)

{

a=100;

b=200;

}

system.out.print(a+" "+b);

Output:

100 200

||Please mark me as brainlist||

Similar questions