correct the code and and identify the name of error in the below code? String number = “1”; switch ( number ) { case 1: System.out.println( "The number is 1" ); break; case 2: System.out.println( "The number is 2" ); break; default: System.out.println( "The number is not 1 or 2" ); break; }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter4: Making Decisions
Section: Chapter Questions
Problem 3RQ
icon
Related questions
Question

correct the code and and identify the name of error in the below code?

String number = “1”;

switch ( number )

{

case 1:

System.out.println( "The number is 1" );

break;

case 2:

System.out.println( "The number is 2" );

break;

default:

System.out.println( "The number is not 1 or 2" );

break;

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of Flowchart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,