0
Using switch case print the english word for the number depending upon its value
only write method -assume that the class & main method have been defined
1 Respuesta
0
int number;
switch(number){
case 1 :
System.out.println("Uno")
break;
case 2 :
System.out.println("Dos")
break;
case 3 :
System.out.println("Tre")
break;
default :
System.out.println("Not a Number")
break;
}
on VB that Case can contain "conditional statement" like :
"case number = 1 : " , in java seems able , "default : " case is optional just in case number unknown.
use :
try{
}catch(exception e){
}
to filter error whenever it not numbers.