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

java example to throw exception



import java.util.Scanner;

public class Collision{

public static void main(String[] args){
int x=0;
System.out.println("     ONE WAY \nDo Not Take a U Turn");
Scanner inp=new Scanner(System.in);
x=inp.nextInt();
try{
if(x>0){
throw new Exception("Please Stop Immediately In Order To Avoide Collision");
}
else{
System.out.println("Have a Safe Journey");
}
}
catch (Exception ex){
System.out.println(ex.getMessage());
}
}
}

No comments:

Post a Comment