- Paperback: 312 pages
- Publisher: Addison-Wesley Professional (July 4, 2005)
- Language: English
- ISBN-10: 032133678X
- ISBN-13: 978-0321336781
- Product Dimensions: 7.4 x 0.9 x 9.1 inches
- Shipping Weight: 1.4 pounds (View shipping rates and policies)
- Average Customer Review: 44 customer reviews
- Amazon Best Sellers Rank: #208,258 in Books (See Top 100 in Books)
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Java Puzzlers: Traps, Pitfalls, and Corner Cases
Use the Amazon App to scan ISBNs and compare prices.
Frequently bought together
Customers who bought this item also bought
From the Back Cover
""Every programming language has its quirks. This lively book reveals oddities of the Java programming language through entertaining and thought-provoking programming puzzles.""
--Guy Steele, Sun Fellow and coauthor of "The Java(TM) Language Specification"
""I laughed, I cried, I threw up (my hands in admiration).""
--Tim Peierls, president, Prior Artisans LLC, and member of the JSR 166 Expert Group
How well do you really know Java? Are you a code sleuth? Have you ever spent days chasing a bug caused by a trap or pitfall in Java or its libraries? Do you like brainteasers? Then this is the book for you!
In the tradition of "Effective Java(TM)," Bloch and Gafter dive deep into the subtleties of the Java programming language and its core libraries. Illustrated with visually stunning optical illusions, "Java(TM) Puzzlers" features 95 diabolical puzzles that educate and entertain. Anyone with a working knowledge of Java will understand the puzzles, but even the most seasoned veteran will find them challenging.
Most of the puzzles take the form of a short program whose behavior isn't what it seems. Can you figure out what it does? Puzzles are grouped loosely according to the features they use, and detailed solutions follow each puzzle. The solutions go well beyond a simple explanation of the program's behavior--they show you how to avoid the underlying traps and pitfalls for good. A handy catalog of traps and pitfalls at the back of the book provides a concise taxonomy for future reference.
Solve these puzzles and you'll never again fall prey to the counterintuitive or obscure behaviors that can fool even the most experienced programmers.
About the Author
Joshua Bloch is a principal engineer at Google and a Jolt Award-winner. He was previously a distinguished engineer at Sun Microsystems and a senior systems designer at Transarc. Josh led the design and implementation of numerous Java platform features, including JDK 5.0 language enhancements and the award-winning Java Collections Framework. He holds a Ph.D. in computer science from Carnegie Mellon University.
Neal Gafter is a software engineer and Java evangelist at Google. He was previously a senior staff engineer at Sun Microsystems, where he led the development of the Java compiler and implemented the Java language features in releases 1.4 through 5.0. Neal was a member of the C++ Standards Committee and led the development of C and C++ compilers at Sun Microsystems, Microtec Research, and Texas Instruments. He holds a Ph.D. in computer science from the University of Rochester.
Top customer reviews
There was a problem filtering reviews right now. Please try again later.
It is a kind of book that you simply can't stop reading. For anyone familiar with Java it will be full of amazing discoveries, regardless of how well you know the language. The book is only about 250 pages, and it is full of intelligent humor, which is ironic and friendly at the same time, making it very easy to read. I appreciate the way it is spiced with some optical illusions (you'll find a reference in the end). There's a complete summary of all "lessons learned", which fits in about 10 pages of very condensed programming wisdom -- I would've bought this book for this chapter alone.
All in all -- amazing book, one of the true gems. Don't think twice -- buy it now :)
I thought I'd be good at this kind of puzzle. As an academic, I wrote about programming languages. I read Bloch's "Effective Java" book. Twice. I follow its advice religously and make my coworkers read it. I've read most of the source code for String, StringBuffer and the collections framework and I/O streams. I just came off a week-long coding project where I did exclusively bit-level I/O with all the shifts and masks you could ask for. I was wrong. I got about 1/5 of the puzzles right if I give myself partial credit for diagnosing the boundary condition in the question and having the right answer be in my top two or three guesses.
Unless you've written the bit fiddling parts of a JVM implementation, or are the kind of person who can remember minute details of the specification, you'll most likely suffer. And love it. Then you can relate the puzzles at gatherings of geeks and look on with a smug grin as they twist in the wind. These would be perfect interview questions for a sadistic HR person.
Overall, this book's a jaw-dropping, eye-opening, brain-melting overview of the kind of boundary conditions you can run into with very simple constructions. Most of the puzzles seem to involve implicit conversions done by the JVM, some involve 1.5 features, some involve class inheritance, others exceptions. Almost all of the puzzles contain links to the boundary-condition definition in the Java language spec.
I'll do better next time. Really.
It's not easy to address real-world problems in such a generic way. This book really makes the complication simple. Great job!
Most recent customer reviews
The segments are short enough for reading in odd moments.Read more