4
My question is in switch (opcao). To perform one of the cases it is necessary to enter with capital letters. Is there any string or Java character conversion function from lowercase to uppercase like in C (tolower and toupper).
If only for characters, the nextLine() (allowed only for String) to enter value I will have to switch to what?
package jjoi;
import java.util.Scanner;
public class principal {
//i. incluir clientes na lista (informando somente nome e bairro)
//ii. incluir funcionários na lista (informando somente nome, bairro e setor em que trabalha)
//iii. apresentar todas as pessoas na lista que moram em um determinado bairro (informado pelo usuário)
public static void main(String[] args){
Scanner entrada= new Scanner(System.in);
String opcao;
System.out.println("MENU DE ESCOLHAS");
System.out.println("A- INCLUIR CLIENTES NA LISTA");
System.out.println("B- INCLUIR FUNCIONARIOS NA LISTA");
System.out.println("C- APRESENTAR TODAS AS PESSOAS NA LISTA QUE MORAM EM UM DETERMINADO BAIRRO");
opcao=entrada.nextLine();
switch(opcao)
{
case "A": System.out.println("INCLUINDO CLIENTES NA LISTA...");
break;
case "B": System.out.println("INCLUINDO FUNCIONARIOS NA LISTA...");
break;
case "C": System.out.println("APRESENTANDO TODAS AS PESSOAS NA LISTA
QUE MORAM EM UM DETERMINADO BAIRRO...");
break;
}
}
}
String c = "ABC"; c = c.toLowerCase();– Jefferson Quesado
In this case, for capital letters it is
.toUpperCase(). And I use it when there’s need here– Jefferson Quesado