Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

8. Good Citizenship > Criminal Behavior

Criminal Behavior

What happens when an antisocial criminal moves into the neighborhood? java.util.Calendar exhibits lots of hostile behavior toward the other citizens in the Java world. It allows engineering purity to override common sense. The constant values that define the months start counting from 0 (which is the standard in the rest of Java), meaning that if you pass the number 2 to set the month, it sets March. I understand the consistency of everything being numbered from 0, but it is insane to take a well-known association (month numbers) and override it.

Calendar also doesn’t maintain its own internal state correctly. What happens when you execute the following code?


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint