Computer Applications
Give the output of the following
switch (x)
{
case 'M' :
System.out.print ("Microsoft Teams");
break;
case 'G':
System.out.print ("Google Meet");
default:
System.out.print("Any Software");
break;
case 'W':
System.out.print("Web Ex");
break;
}
when x = 'g'
- Google Meet
- Any Software
- Google Meet
Any Software - Web Ex
Java Conditional Stmts
3 Likes
Answer
Any Software
Reason — Java is a case sensitive language and thus 'G' and 'g' are treated as two different characters. Since the value of x does not match with any case, the default case will be executed. Thus, "Any Software" will be printed.
Answered By
1 Like
Related Questions
What will be the output of the following code?
String a[] = {"MI", "Samsung", "Micromax", "One Plus"}; System.out.println(a[3].length());- 8
- 7
- 5
- 9
Polymorphism is broadly used in implementing ……………
- inheritance
- encapsulation
- abstraction
- literals
Given array int Z[ ] = {15, 16, 17} ; it will occupy …………… bytes in memory.
- 3
- 12
- 24
- 64
In …………… search, the algorithm uses the middle value of the array for the search operation.
- binary
- linear
- bubble
- selection