-4
Good evening, I started using JAVA a little while ago, I wanted to know how to make the user can type the value with "." point. In case anyone can help, I’d appreciate it!!
import java.io.Console;
import java.util.Scanner;
class Main {
public static void main (String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Entre com o numero de notas");
int quantidadeNotas = sc.nextInt();
int notas[] = new int[quantidadeNotas];
for (int i = 0; i < quantidadeNotas; i++){
System.out.println ("Entre com a nota " + (i+1));
notas[i] = sc.nextInt();
}
for (int i = 0; i < quantidadeNotas; i++){
System.out.println (notas[i]);
}
}
}
"how do I get the user to type the value with "."" cannot "force" the user to type, but can validate and ask to type again, now it is no use doing this if you are reading an integer, integer has no point
nextInt
– Ricardo Pontual