0% found this document useful (0 votes)
10 views1 page

Package Import Public Class Public Static Void: // Auto-Generated Method Stub

The document defines a Java program that uses a switch statement to read a single character from user input and print a message depending on whether the character is a vowel ('a', 'e', 'i', 'o', or 'u') or not. The program prompts the user to enter a vowel, uses a Scanner to read a character, and prints either "se leyo la letra [vowel]" or "vocal invalida" depending on the character.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Package Import Public Class Public Static Void: // Auto-Generated Method Stub

The document defines a Java program that uses a switch statement to read a single character from user input and print a message depending on whether the character is a vowel ('a', 'e', 'i', 'o', or 'u') or not. The program prompts the user to enter a vowel, uses a Scanner to read a character, and prints either "se leyo la letra [vowel]" or "vocal invalida" depending on the character.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

package clase2;

import java.util.Scanner;
public class main {

public static void main(String[] args) {
// TODO Auto-generated method stub

String ch="a";
Scanner kb=new Scanner(System.in);
System.out.println("por el amor de dios ingrese una vocal");
ch=kb.next();
switch(ch){
case "a":
System.out.println("se leyo la letra a");
break;
case "e":
System.out.println("se leyo la letra e");
break;
case "i":
System.out.println("se leyo la letra i");
break;
case "o":
System.out.println("se leyo la letra o");
break;
case "u":
System.out.println("se leyo la letra u");
break;
default:
System.out.println("vocal invalida");
break;
}
}

}

You might also like