2147483648 and 2147483647, which is the biggest value of integer?

Viewed 429

When I read the Java 13 spec, I saw 2 things as follows:

  1. The largest decimal literal of type int is 2147483648 (2^31).
  2. The largest positive hexadecimal, octal, and binary literals of type int - each of which represents the decimal value 2147483647 (2^31-1) - are respectively

I don't understand exactly what is the literal. But:

For me, I think when we mention about the "largest decimal literal of type int", we just focus on what the int type can show, it means that in terms of lexical/vocabulary, the largest digits sequence available is 2^31.

This also means that regardless of negative or positive integer semantically, we cannot write any digits sequence exceeded 2^31 (e.g 2^31 + 1).

Although "literal" can have many meanings, in this case, I think that it just refers to lexical terms.

So, my explanation is correct or incorrect? Anyone can help me, please.

Thank you

0 Answers
Related