You are here: Home / Topics / Program to use Wrapper class with switch statement in Java

Program to use Wrapper class with switch statement in Java

Filed under: Java on 2023-09-19 08:10:10

// Program to use Wrapper class with switch statement.

class  Wrapper6
{
public static void main(String args[ ]) 
{
 Integer iOb = 2;
 
 switch(iOb) 
 {
  case 1: 
   System.out.println("one");
   break;
  case 2: 
   System.out.println("two");
   break;
  case 3: 
   System.out.println("three");
   break;
  case 4: 
   System.out.println("four");
   break;
  case 5: 
   System.out.println("five");
   break;
  default: 
   System.out.println("default");
   break;
 }
}
}


Output:

two

About Author:
S
Shyam Dubey     View Profile
I am a good learner. I like posting new questions on this plateform to help other students.