Computer Science, asked by kartikey9820, 1 year ago

4. int a=1,b=2,c=3;
switch(p)
case 1: a++;
case 2: ++b;
break;
case 3: CM;
System.out.println(a + "," + b + ",» +c);
When, (i) p = 1
(i) p = 3​

Answers

Answered by mohan1508
2

(i) When p=1

2,3,3 ( there is no break statement after case 1 , so case 2 is also executed)

(ii) syntax error

( since you have typed CM in case 3 - an increment statement or assignment statement expected)

Hope this helps

All The Best

Similar questions