Computer Science, asked by FrankeeShyam, 3 months ago

if construct using switch case if (ch =='y')
{x=x-10;
system.out.println(x);}
else
if (ch == 'y' ){
x + = 10 ;
system.out.println (x);}
else
system.out.println( "discontinue"),​

Answers

Answered by CdtRaghib
2

Explanation:

switch(ch)

{

case 'y':

x += 10;

system.out.println (x);

break;

/*Without break statement it won't stop, we'll use "break" to stop the switch*/

default:

system.out.println("discontinue");

/*No need for "break" statement, as there is nothing after the default and the switch will get stopped automatically*/

}

I hope this will help you.

Similar questions