find the output of the following code.
int i=1
while(i<=6)
{
switch (i++)
{
case 2: system. out. println(i);
case 3: i++;
case 4; system. out. println(i+4);
case 5; ++i;
case 6; system. out. println(i);
default; system. out. println(i++);
}
}
Answers
Answered by
1
.........Program..........
class New{
public static void main(String[] args) {
int i=1;
while(i<=6)
{
switch (i++)
{
case 2: System.out.println(i);
case 3: i++;
case 4: System.out.println(i+4);
case 5: ++i;
case 6: System.out.println(i);
default:System.out.println(i++);
}
}
}
}
....Output....
2
9
6
6
ashutosh4138:
nitish . can you show me dry working. plz
Similar questions