import java.util.*; class Example{ public static void main(String args[]){ Scanner input=new Scanner(System.in); int[] x=new int[4]; String[] y=new String[5]; int r='y'; int count=0; while('y'==r);{ System.out.print("Enter student ID :"); x[count]=Integer.parseInt(input.nextLine()); System.out.print("Enter student Name :"); y[count]=input.nextLine(); System.out.print("Student has been added successfully.Do you want to add a new student (y/n) :"); r =input.next().charAt(0); if('y'==r){ count++; } } } }