Answers for "enumeration in switch java"

0

java enum in switch statement

private enum FooNum {
  //Options for your enum
  A, 
  B
  }

public void foo(FooNum fooNum){

switch(fooNum){
	case A:		
	    //you selected A
    	break;
  	case B:
    	//you selected B
		break;  
  	default:			
	    //do some stuff
	    break;
	} 
}
Posted by: Guest on February-03-2022

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language