I have a problem with my code, in a loop of an array I enter the number but the first element of array doesn't enter and skip. Please tell me what is my wrong in the code?
Scanner sc= new Scanner(System.in);
int j;
String correos=new String();
int largo;
System.out.println("------Cuantas direcciones va a ingresar?----");
largo=sc.nextInt();
String Correos[]=new String[largo];
for(int i=0; i<Correos.length; i++){
System.out.println("------Introduzca esas direcciones----");
Correos[i]=sc.nextLine();
}
System.out.println(Arrays.toString(Correos));
}
//Output
------Cuantas direcciones va a ingresar?----
3
------Introduzca esas direcciones----
------Introduzca esas direcciones----
ddddd
------Introduzca esas direcciones----
dddd
[, ddddd, dddd]