import java.util.Scanner;
public class DisplayRecords {
public static void main(String[] args){
try{
System.out.println("Enter The Roll Numbers of The Students");
int []a=new int[10];
Scanner input=new Scanner(System.in);
for(int i=0;i<10;i++){
a[i]=input.nextInt();
}
System.out.println("Enter The Name Of The Students");
String []s=new String[10];
for(int i=0;i<10;i++){
s[i]=input.nextLine();
}
System.out.println("Entered Roll No for the Students");
for(int i=0;i<10;i++){
System.out.println(a[i]);
}
System.out.println("Entered Name of The Students");
for(int i=0;i<10;i++){
System.out.println(s[i]);
}
}
catch(ArrayIndexOutOfBoundsException ae){
System.out.println("Caught Exception");
}
}
}
public class DisplayRecords {
public static void main(String[] args){
try{
System.out.println("Enter The Roll Numbers of The Students");
int []a=new int[10];
Scanner input=new Scanner(System.in);
for(int i=0;i<10;i++){
a[i]=input.nextInt();
}
System.out.println("Enter The Name Of The Students");
String []s=new String[10];
for(int i=0;i<10;i++){
s[i]=input.nextLine();
}
System.out.println("Entered Roll No for the Students");
for(int i=0;i<10;i++){
System.out.println(a[i]);
}
System.out.println("Entered Name of The Students");
for(int i=0;i<10;i++){
System.out.println(s[i]);
}
}
catch(ArrayIndexOutOfBoundsException ae){
System.out.println("Caught Exception");
}
}
}
No comments:
Post a Comment