0
import java.util.Scanner; public class Program { public static void main(String[] args) { int[] arr=new int[5]; for(int i=0;i<5;i++) { Scanner ch=new Scanner(System.in); arr[i]=ch.nextInt(); System.out.println(arr[i]); } }}
I want to know the error in this code
2 Antworten
+ 3
put the scanner object created to outside of the loop.
0
Thank you dude