• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Rules and Exceptions

 
John Held
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems like one of the difficulties in fully understanding Java is that it is difficult to find an organized list of Java's rules--and then
the exceptions to the rule.
Does anyone know of such an organized list?
Here is an example of what I'm talking about:
Rule: a switch argument can be anything smaller or equal to an int
Exception: if one of the case statements contains a number larger than the type of switch argument, we have a compiler error
Example:
byte a = 7;
switch (a) {
case 128:
System.out.println("We have a problem here.");
break;
 
Brian Lugo
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to refer to the Java Language Specification:
http://java.sun.com/docs/books/jls/second_edition/html/jTOC.doc.html
I hope this helps,
Brian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic