Computer Science Canada

Throwing exception in Java

Author:  Panphobia [ Wed Apr 17, 2013 11:51 pm ]
Post subject:  Throwing exception in Java

The traditional way I would throw an exception in a method/function I would just put throws @@@@@@@@Exception, but I recently found out while coding a BFS for a sliding puzzle game that you can throw an illegal exception just by putting 0/0 here is an example
code:
return (three.indexOf(car) != -1) ? 3 : two.indexOf(car) != -1 ? 2 : 0 / 0;
now I just wanted to ask why does that throw an illegal argument exception, and nowhere on the internet could I find an answer for that. If anyone knows could you clear that up? Thanks!

Author:  Tony [ Thu Apr 18, 2013 12:16 am ]
Post subject:  RE:Throwing exception in Java

stacktrace please.


: