Why do Java programmers like to name a variable "clazz"?
It's simply because 'class' is a reserved keyword, hence Class class
isn't allowed. Therefore you'll see Class clazz
or Class cls
.
Because they cannot use the word they want to use which is class
. It is reserved.
clazz
has been used in Java in place of the reserved word "class" since JDK 1.0. "class" is what you want, but abbreviating or inserting junk ("a", "the", "_", etc) reduces clarity. clazz
just says class. "International" English speakers (those reading both British and American English) are used to transposing 's' and 'z'.
Since Java has had disclosed source and a suitable culture right from the start, worthwhile Java code and tutorials pick up the same conventions. That's one of the great things about the Java ecosystem, which I think has been an important part of its success.