0
Hello, I want the user to set the value of a variable, but it should set it only after the while. My question is, how do you do it? Here’s the piece I’m doubting.
public static void chama_programa(){
Scanner sc = new Scanner(System.in);
int num;
while (!(num < 1000)){
System.out.println("Escreva um numero menor que 1000");
num = sc.nextInt();
Because the way this one says that the variable one needs to be initialized while direct without giving chance to be typed.
This actually did not work because, as I wrote, when I start it with any number including zero the program goes straight without asking the user to type.
– Tadeu Agostini
Well, then there must be some other error in your code. put the full code please.
– lvr7