void addPrerequisite(Course course)throws PrerequisiteAlreadyExistsException,CourseNotFoundException {
if(course_type==1)
{
if(preRequisites.contains(course))
throw new PrerequisiteAlreadyExistsException("This prerequisite already exists in the given course");
else if(//check if the prereq you are trying to add is present in already available psychology courses or not)
throw new CourseNotFoundException("This course is not present in the available courses");
else
preRequisites.add(course);
}
}
Throwing multiple exceptions in a method
Page 1 of 17 Replies - 330 Views - Last Post: 08 April 2012 - 09:37 PM
#1
Throwing multiple exceptions in a method
Posted 08 April 2012 - 08:00 PM
Hi the following is my method which throws 2 exceptions. But it seems that there is a syntax error in this code. Can anyone tell me what is wrong in the following code
Replies To: Throwing multiple exceptions in a method
#2
Re: Throwing multiple exceptions in a method
Posted 08 April 2012 - 08:07 PM
Please post your exact error here.
#3
Re: Throwing multiple exceptions in a method
Posted 08 April 2012 - 08:10 PM
#4
Re: Throwing multiple exceptions in a method
Posted 08 April 2012 - 08:12 PM
What is
if(course_type==1)
?
if(course_type==1)
?
#5
Re: Throwing multiple exceptions in a method
Posted 08 April 2012 - 08:14 PM
#6
Re: Throwing multiple exceptions in a method
Posted 08 April 2012 - 08:15 PM
else if(//check // you need code here to test something
#7
Re: Throwing multiple exceptions in a method
Posted 08 April 2012 - 09:31 PM
#8
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|