Computer Science, asked by saheenas466, 7 months ago

Consider the following code:
char c = 'a';
switch(c)
{ case 'a':
case 'b' :
default :
System.out.println ("A");
System.out.println ("B");
System.out.println ("C");

For this code, which of the following statement is true ?

(a) output will be a
(b) output will be a followed by B
(c) output will be A, followed by B, and then followed by C
(d) code is illegal and therefore will not compile.

Answers

Answered by DigitalGuru40
0

Answer:

D

Explanation:

code is illegal and therefore will not compile

Answered by mahimapanday53
0

Concept:

Each value is referred to as a case, and each switch case is compared to the variable that is being turned on.

Switch case statements use a selection-control method to let a value shift execution control.

They can be used in place of lengthy if statements that compare a variable to many integral values.

A multiway branch statement is the switch statement. It makes it simple to route execution to various areas of code based on the expression's value.

Find:

The output of the code.

Solution:

There is no break statement in the code. Option(d) is correct.

#SPJ3

Similar questions