import java.util.Scanner;
public class CodigoDeBarras {
public static void main (String[] args) {
do {
Scanner sc = new Scanner(System.in);
System.out.println("Informe os primeiros 12 caracteres do codigo de barras: \n");
String codigo = sc.nextLine();
} while (codigo.length() != 12);
}
}
I'm trying to get you to repeat the message and read the user's data until it enters a string with an exact 12 characters, but it is giving the following error: "variable is already defined in method main (String [] args)"