Java Puzzlers: Traps, Pitfalls, and Corner Cases (Paperback)
暫譯: Java 雜謎:陷阱、險境與邊界案例 (平裝本)

Joshua Bloch, Neal Gafter

買這商品的人也買了...

相關主題

商品描述

Description:

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™, Bloch and Gafter dive deep into the subtleties of the Java programming language and its core libraries. Illustrated with visually stunning optical illusions, Java™ 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.

 

Table of Contents:

1. Introduction.

2. Expressive Puzzlers.

    Puzzle 1: Oddity

    Puzzle 2: Time for a Change

    Puzzle 3: Long Division

    Puzzle 4: It's Elementary

    Puzzle 5: The Joy of Hex

    Puzzle 6: Multicast

    Puzzle 7: Swap Meat

    Puzzle 8: Dos Equis

    Puzzle 9: Tweedledum

    Puzzle 10: Tweedledee

3. Puzzlers with Character.

    Puzzle 11: The Last Laugh

    Puzzle 12: ABC

    Puzzle 13: Animal Farm

    Puzzle 14: Escape Rout

    Puzzle 15: Hello Whirled

    Puzzle 16: Line Printer

    Puzzle 17: Huh?

    Puzzle 18: String Cheese

    Puzzle 19: Classy Fire

    Puzzle 20: What's My Class?

    Puzzle 21: What's My Class, Take 2

    Puzzle 22: Dupe of URL

    Puzzle 23: No Pain, No Gain

4. Loopy Puzzlers.

    Puzzle 24: A Big Delight in Every Byte

    Puzzle 25: Inclement Increment

    Puzzle 26: In the Loop

    Puzzle 27: Shifty i's

    Puzzle 28: Looper

    Puzzle 29: Bride of Looper

    Puzzle 30: Son of Looper

    Puzzle 31: Ghost of Looper

    Puzzle 32: Curse of Looper

    Puzzle 33: Looper Meets the Wolfman

    Puzzle 34: Down for the Count

    Puzzle 35: Minute by Minute

5. Exceptional Puzzlers.

    Puzzle 36: Indecision

    Puzzle 37: Exceptionally Arcane

    Puzzle 38: The Unwelcome Guest

    Puzzle 39: Hello, Goodbye

    Puzzle 40: The Reluctant Constructor

    Puzzle 41: Field and Stream

    Puzzle 42: Thrown for a Loop

    Puzzle 43: Exceptionally Unsafe

    Puzzle 44: Cutting Class

    Puzzle 45: Exhausting Workout

6. Classy Puzzlers.

    Puzzle 46: The Case of the Confusing Constructor

    Puzzle 47: Well, Dog My Cats!

    Puzzle 48: All I Get Is Static

    Puzzle 49: Larger Than Life

    Puzzle 50: Not Your Type

    Puzzle 51: What's the Point?

    Puzzle 52: Sum Fun

    Puzzle 53: Do Your Thing

    Puzzle 54: Null and Void

    Puzzle 55: Creationism

7. Library Puzzlers.

    Puzzle 56: Big Problem

    Puzzle 57: What's in a Name?

    Puzzle 58: Making a Hash of It

    Puzzle 59: What's the Difference?

    Puzzle 60: One-Liners

    Puzzle 61: The Dating Game

    Puzzle 62: The Name Game

    Puzzle 63: More of the Same

    Puzzle 64: The Mod Squad

    Puzzle 65: A Strange Saga of a Suspicious Sort

8. Classier Puzzlers.

    Puzzle 66: A Private Matter

    Puzzle 67: All Strung Out

    Puzzle 68: Shades of Gray

    Puzzle 69: Fade to Black

    Puzzle 70: Package Deal

    Puzzle 71: Import Duty

    Puzzle 72: Final Jeopardy

    Puzzle 73: Your Privates Are Showing

    Puzzle 74: Identity Crisis

    Puzzle 75: Heads or Tails?

9. More Library Puzzlers.

    Puzzle 76: Ping Pong

    Puzzle 77: The Lock Mess Monster

    Puzzle 78: Reflection Infection

    Puzzle 79: It's a Dog's Life

    Puzzle 80: Further Reflection

    Puzzle 81: Charred Beyond Recognition

    Puzzle 82: Beer Blast

    Puzzle 83: Dyslexic Monotheism

    Puzzle 84: Rudely Interrupted

    Puzzle 85: Lazy Initialization

10. Advanced Puzzlers.

    Puzzle 86: Poison-Paren Litter

    Puzzle 87: Strained Relations

    Puzzle 88: Raw Deal

    Puzzle 89: Generic Drugs

    Puzzle 90: It's Absurd, It's a Pain, It's Superclass!

    Puzzle 91: Serial Killer

    Puzzle 92: Twisted Pair

    Puzzle 93: Class Warfare

    Puzzle 94: Lost in the Shuffle

    Puzzle 95: Just Desserts

Appendix A: Catalog of Traps and Pitfalls.

Appendix B: Notes on the Illusions.

References.

Index.

商品描述(中文翻譯)

描述:

你對 Java 了解多少?你是一位程式碼偵探嗎?你是否曾經花了幾天時間追蹤由 Java 或其函式庫中的陷阱或隱患引起的錯誤?你喜歡腦筋急轉彎嗎?那麼這本書就是為你而寫的!

在《Effective Java™》的傳統下,Bloch 和 Gafter 深入探討 Java 程式語言及其核心函式庫的微妙之處。這本《Java™ Puzzlers》以視覺上驚人的光學錯覺為插圖,包含 95 道惡魔般的謎題,既具教育意義又富有娛樂性。任何對 Java 有基本了解的人都能理解這些謎題,但即使是最資深的專家也會覺得它們具有挑戰性。

大多數謎題的形式是一段短程式,其行為並不像表面上看起來那樣。你能找出它的作用嗎?謎題根據所使用的特性進行鬆散分組,每個謎題後面都有詳細的解答。解答不僅僅是對程式行為的簡單解釋——它們還告訴你如何徹底避免潛在的陷阱和隱患。書末提供了一個方便的陷阱和隱患目錄,為未來參考提供了簡明的分類。

解決這些謎題後,你將不再成為那些即使是最有經驗的程式設計師也會被迷惑的反直覺或晦澀行為的受害者。

目錄:

1. 介紹
2. 表達性謎題
- 謎題 1: 奇異性
- 謎題 2: 變化的時候
- 謎題 3: 長除法
- 謎題 4: 基本的
- 謎題 5: 十六進制的樂趣
- 謎題 6: 多播
- 謎題 7: 交換肉
- 謎題 8: Dos Equis
- 謎題 9: Tweedledum
- 謎題 10: Tweedledee
3. 具有特徵的謎題
- 謎題 11: 最後的笑聲
- 謎題 12: ABC
- 謎題 13: 動物農場
- 謎題 14: 逃脫路線
- 謎題 15: 你好,世界
- 謎題 16: 行列印表機
- 謎題 17: 嗯?
- 謎題 18: 字串起司
- 謎題 19: 優雅的火
- 謎題 20: 我的類別是什麼?
- 謎題 21: 我的類別是什麼,第二次
- 謎題 22: URL 的重複
- 謎題 23: 不痛不癢
4. 循環謎題
- 謎題 24: 每個位元組中的大樂趣
- 謎題 25: 不利的增量
- 謎題 26: 在循環中
- 謎題 27: 變化的 i
- 謎題 28: 循環器
- 謎題 29: 循環器的新娘
- 謎題 30: 循環器之子
- 謎題 31: 循環器的幽靈
- 謎題 32: 循環器的詛咒
- 謎題 33: 循環器遇見狼人
- 謎題 34: 倒數計時
- 謎題 35: 分分秒秒
5. 例外謎題
- 謎題 36: 優柔寡斷
- 謎題 37: 特別晦澀
- 謎題 38: 不受歡迎的客人
- 謎題 39: 你好,再見
- 謎題 40: 不情願的建構子
- 謎題 41: 領域與流
- 謎題 42: 被循環困住
- 謎題 43: 特別不安全
- 謎題 44: 逃課
- 謎題 45: 耗盡的鍛鍊
6. 優雅的謎題
- 謎題 46: 令人困惑的建構子的案例
- 謎題 47: 哇,狗我的貓!
- 謎題 48: 我得到的只是靜態
- 謎題 49: 大於生命
- 謎題 50: 不是你的類型
- 謎題 51: 這有什麼意義?
- 謎題 52: 總和的樂趣
- 謎題 53: 做你該做的事
- 謎題 54: 無效的
- 謎題 55: 創造論
7. 函式庫謎題
- 謎題 56: 大問題
- 謎題 57: 名字裡有什麼?
- 謎題 58: 把它搞砸
- 謎題 59: 有什麼不同?