Witshaper is the Professional (Computing Skills, English Learning and Soft Skills) Skill Development Training Center. We provide Professional IT Courses and Soft Skill Training in Dehradun to Students, Employees and organization. Who wish to pursue a career in IT Technology. Witshaper is led by a motivated team of IT experts and Soft Skill Professionals. We provide high quality trainings. Our Emphasis is on giving the practical knowledge to the students, so that they will get to know in depth and never forget what they opt, we provide to the students real learning environment. Witshaper prepares students and professionals to be the part of this growing industry. Be a part of Witshaper and get your dreams successful

Wednesday, 20 May 2015

arrays and exception example in java

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");
}
}
}

No comments:

Post a Comment