import java.io.*;
import java.util.*;
class Nums
{
public static void main(String args[])
{
int i=0,j=0;
try
{
String s[]=new String[9];
int b[]=new int[10];
System.out.println("Enter the Name of 10 students:");
Scanner in=new Scanner(System.in);
for(i=0;i<10;i++)
{
s[i]=in.nextLine();
}
}
catch(ArrayIndexOutOfBoundsExeption e)
{
System.out.println("Program Not Terminated Exception Caught\n"+e);
String s[]=new String[10];
int b[]=new int[10];
System.out.println("----CONTINUE----");
System.out.println("Enter the Name of 10 students:");
Scanner in=new Scanner(System.in);
for(i=0;i<10;i++)
{
s[i]=in.nextLine();
}
System.out.println("Enter the Roll no of 10 students:");
for(j=0;j<10;j++)
{
b[j]=in.nextInt();
}
i=j=0;
System.out.println("Name and Roll No are:");
while(i<10&&j<10)
{
System.out.println(s[i]+"\t"+b[j]);
i++;j++;
}
}
}
}
import java.util.*;
class Nums
{
public static void main(String args[])
{
int i=0,j=0;
try
{
String s[]=new String[9];
int b[]=new int[10];
System.out.println("Enter the Name of 10 students:");
Scanner in=new Scanner(System.in);
for(i=0;i<10;i++)
{
s[i]=in.nextLine();
}
}
catch(ArrayIndexOutOfBoundsExeption e)
{
System.out.println("Program Not Terminated Exception Caught\n"+e);
String s[]=new String[10];
int b[]=new int[10];
System.out.println("----CONTINUE----");
System.out.println("Enter the Name of 10 students:");
Scanner in=new Scanner(System.in);
for(i=0;i<10;i++)
{
s[i]=in.nextLine();
}
System.out.println("Enter the Roll no of 10 students:");
for(j=0;j<10;j++)
{
b[j]=in.nextInt();
}
i=j=0;
System.out.println("Name and Roll No are:");
while(i<10&&j<10)
{
System.out.println(s[i]+"\t"+b[j]);
i++;j++;
}
}
}
}
No comments:
Post a Comment