0
import java.util.*;
    public static void main(String args[]) {
        int n,i;
        Scanner sc=new Scanner(System.in);
        n=sc.nextInt();
        String[]arr=new String[n];
        for(i=0;i<n;i++) { 
            arr[i]=sc.nextLine();
        }
        for(i=0;i<n;i++) {
            System.out.println(arr[i]);
        }
    }

When executed,for example if the array size is 2 it only accepts one string and displays it.That is, it accepts strings one size less than the actual array size and displays it.Can you guyzz help me to resolve this issue?

Jens
  • 67,715
  • 15
  • 98
  • 113
Vishnu
  • 1
  • 1

0 Answers0