C# Programming - Control Instructions - Discussion
Discussion Forum : Control Instructions - General Questions (Q.No. 21)
21.
Which of the following statements is correct about the C#.NET code snippet given below?
int i, j, id = 0; switch (id)
{
case i:
Console.WriteLine("I am in Case i");
break;
case j:
Console.WriteLine("I am in Case j");
break;
}
Discussion:
2 comments Page 1 of 1.
Pepe said:
7 years ago
@Div.
That's not true, id, i and j are integers and the switch cases are also using ints.
That's not true, id, i and j are integers and the switch cases are also using ints.
Div said:
8 years ago
Because id value is integer but in case they are using character so compile time error will come.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers