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

11th Sep 2017, 5:42 AM
Sathya kothapalli
Sathya kothapalli - avatar
1 Odpowiedź
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.
11th Sep 2017, 10:36 PM
Mikhael Anthony
Mikhael Anthony - avatar