To answer seriously: it might not be most people's favorite language, but it's probably one that the most practicing programmers today and people who ever took a programming language in school any time in the last 30 years, can read; and therefore it's probably the best choice as the basis for a humor book.
Java has so little syntax—and yet what little syntax it has is C-ish—that it's mutually intelligible to everybody from programmers who only know C, to programmers who only know Haskell. (Maybe not to programmers who only ever learned 6502 assembler, but they have their own humor books published 40 years ago.)
(Is there a term for this in linguistics? A measure of the eigenvector of mutual intelligibility a language has to all other spoken/written languages?)
i don't know, but, why not, say, BASIC? (most programmers being able to understand) or, Smalltalk, (little syntax, that ''fits inside a postcard'') or a lisp?
BASIC was commonly understood in the 80s despite lots of very different dialects and also in the 90s mostly because of Visual Basic. Is it still true that developers are familiar with BASIC? I would expect that JavaScript and maybe Python replaced BASIC as lingua franca. JavaScript looks simpler because it basically (pun intended) doesn't have a standard library to learn, with all the problems deriving from that.
Java doesn't seem a bad choice because if one sticks to the basics probably everybody can figure out what a simple program does. Smalltalk, I wonder how many people here ever read a Smalltalk source file [1]. Lisp, maybe more, at least to look once at all those funny parentheses (disclaimer, I wrote my fair share of Lisp but I know the effect it does on most people.)
[1] One random Smalltalk project from the list of trending Smalltalk repositories on GitHub https://github.com/svenvc/zinc
I think you misinterpreted. It's not that more programmers know Java; it's that more programmers know a language with a syntax similar to Java.
I don't really know Java. But I know C, and Java looks enough like C that I can get what Java code is trying to do.
Personally, I've never learned any language with similar-enough syntax to BASIC, to understand what a (real, non-trivial) BASIC program is trying to do. Would I recognize a BASIC subroutine if I saw one? Probably not.
And it's not about a language having "less" syntax, either, but rather about it having very few syntactic features that're unfamiliar. Smalltalk is a rather large novelty the first time you see it. (`ifTrue`? You mean I've got to use closures to branch?)
Looking at my cats, I presume they ignore anything neat and impressive, prepared for them. And instead go for the first thing that satisfies their current whim.
So, a hodgepodge of bash, basic, Python, JavaScript and some C. Or Java if it happens to be just on top in some menu. And NIH: obviously theyr own ZiggyLang or ZazaScript.
Java has so little syntax—and yet what little syntax it has is C-ish—that it's mutually intelligible to everybody from programmers who only know C, to programmers who only know Haskell. (Maybe not to programmers who only ever learned 6502 assembler, but they have their own humor books published 40 years ago.)
(Is there a term for this in linguistics? A measure of the eigenvector of mutual intelligibility a language has to all other spoken/written languages?)