Ema.jar
Ema.jar

Reputation: 2424

Why the object wrapper for an int is Integer and not Int?

I've seen that whe have the following mapping between primitive and object version of a variabile:

So, for all of them the only difference is the first letter of the world. I would like to know why this rule does not apply for int that becomes Integer (and not Int) and for char that becomes Character and not (Char).

I don't know if this is the right place to ask this question but I would really like to know if there is a reason for this choice, even because I teach java to kids and often they ask the same question to me.

Upvotes: 2

Views: 67

Answers (1)

Stephan
Stephan

Reputation: 43013

Because JDK classes honor the Java naming convention.

Class names should be nouns, in mixed case with the first letter of each internal word capitalized. (...) Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).

Reference:

Java naming conventions

Upvotes: 6

Related Questions