0
I made this small program, where I want you to loop, while the user chooses to register more messages.
The error, after compiling the code, says:
required:int
found: no Arguments
Reason: actual and formal argumente lists differ in lenght.
Here is the code snippet:
/*
* Class do registo de mensagens
*/
import java.util.*;
public class RegistoDeMenssagem1
{
public static void main(String[] args)
{
System.out.println("Bem vindo Utilizador");
System.out.println("Introduza o número da recarga");
Scanner kb = new Scanner(System.in);
int Recarga = kb.nextInt(); //criar o mêtodo que verifica se trata-se de int.
String resposta;
boolean sn;
{
System.out.println("Têm mais recarga para registar?");
System.out.println("responda `S´ para continuar ou `N´ para terminar");
resposta = kb.nextLine().trim().toLowerCase();
if (resposta.equals("s"))
{
sn = true;
System.out.println("Introduza o número da recarga");
Scanner kb2 = new Scanner(System.in);
int MaisRecarga = kb.nextInt(); //Aqui criar o exception handler que verifique tratar-se de int.
System.out.println("Têm mais alguma recarga para registar?");
}
else if (resposta.equals("n"))
{
System.out.println("Obrigado, atê a próxima!");
System.exit();
}
}
}
}
In which line the error bursts?
– user28595
error bursts in java:32
– cambine
And what is line 32 of this code?
– user28595
Line 32 of the code is: System.Exit();
– cambine
Good morning friend, the method Exit(), receives a parameter of type int, so the error, tries to use System.Exit(0);
– João
I managed to solve the error but not my problem. that is, I intend that by the option "n" the program make a loop. Thankful.
– cambine
@cambine as doubt was about error, the question has even been answered, the advised is that you create a new question informing the other problem you are facing. You can accept one of the answers below as well, to mark this problem(the error) as fixed.
– user28595