Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Throwing exception in Java
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Panphobia




PostPosted: 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!
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Apr 18, 2013 12:16 am   Post subject: RE:Throwing exception in Java

stacktrace please.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: