0
My program compiled in cmd, but running does not execute the instruction if, showing only the last String and closes. I want the user to have the option to register another message. What possible solutions?
The program is as follows:
/*
 * Class do registo de mensagens
 */
import java.util.*;
public class RegistoDeMenssagem4 {
    public static void main(String[] args) {
        System.out.println("Bem vindo Utilizador"); // o número ou nome do utilizador 
        //Porque o registo de menssagem só é possível para números registados       
        System.out.println("Introduza o número da recarga");
        Scanner kb = new Scanner(System.in);
        int Recarga = kb.nextInt(); // exception para o nùmero
        // Aqui irei introduzir o try-catch exceptions para cada input                                  
        System.out.println("Têm mais recarga para registar?");
        System.out.println("responda `S´ para continuar ou `N´ para terminar");
        String resposta;
        resposta = kb.nextLine();
        if (resposta.equals("s")) {
            System.out.println("Introduza o número da recarga");
            Scanner kb2 = new Scanner(System.in);
            int MaisRecarga = kb.nextInt();
            System.out.println("Têm mais alguma recarga para registar?");
        } else {
            System.out.println("Obrigado, atê o próximo registo.");
            System.exit(0);
        }
    }
}
						
may be a case-by-case issue
– GabrielLocalhost
Replace with
if (resposta.equalsIgnoreCase("s"))if it makes no difference if it’s a capital S or a minuscule.– user28595