CORRE[C]T: [C]ardinality

Many programmers aren’t so hot at counting, especially past ten when our fingers can no longer assist us. Answer the following question quickly and off the top of your head, without benefit of fingers, paper, or Google:

You have to erect a number of fence sections to cover a straight line 12 meters long. Each section of fencing covers 3 meters, and each end of a section must be held up with a fence post:


How many fence posts do you need?

If you’re like most of us, you probably offered an answer in short order, and it’s probably incorrect. Think again. Then take a look at the following figure for the answer. The errors ...

Get Pragmatic Unit Testing in Java 8 with JUnit now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.