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:
M
Mr. Dubey     View Profile
Founder and CEO of MCQ Buddy. I just like to help others. This portal helps students in getting study material free.