Click to follow our Afritutor YouTube Channel, subscribe and click notifications and get updates on new learning videos
<=Back
The following program segment is written using IF statements in Java programming.
Public class Vowel {
Public static void main (string [] args){
Char letter =’o’;
If (letter ==’a’)
System.out.println (letter+” is a vowel”);
Else if (letter ==’e’)
System.out.println (letter+”is a vowel”);
Else if (letter ==’i’)
System.out.println (letter+ ”is a vowel”);
Else if (letter ==’o’)
System.out.println (letter+”is a vowel”);
Else if (letter ==’u’)
System.out.println (letter+”is a vowel”);
Else
System.out.println (letter+”is NOT a vowel”);
}
}
Re-write the segment using a switch structure.
 Viewed: 93 times For Better experience and learning,for video answers, after video ends playing, click next question in the questions list!!!
Share in: