Java Primitive

Last modified on April 1st, 2014 by Joe.

As of the Java Virtual Machine Specification second edition, numeric types, the boolean type (§3.3.4), and the returnAddress type are the three java primitive types supported by JVM.

Most of you may get annoyed, we all know about the primitives of java. That is where from we all started it. But, you may not be aware of a primitive called returnAddress. Surprise isn’t it? This post serves just to bring that primitive to your notice. It is not part of the language construct / api and is not of direct use to an application programmer. But it is good to be aware of the primitive for the sake of completeness.

1) Numeric Types

Numeric types are classified as integral primitive and floating point type primitives
Integral type primitive:

byte –  8-bit signed two’s complement integers: -128 to 127 (-2power7 to 2power7 – 1)
short – 16-bit signed two’s complement integers: -32768 to 32767 (-2power15 to 2power15 – 1)
int – 32-bit signed two’s complement integers
long – 64-bit signed two’s complement integers
char – 16-bit unsigned integers representing Unicode characters (§2.1)

Value ranges from -2power(N-1) to 2power(N-1) – 1 ; where N is the bit size like 8 or 16,…

In the above, two’s complement means, a negative number will be denoted by the two’s complent of its absolute value. Most significat digit (MSB) will denote if the number is positive or negative. MSB will be 0 if the number is positive and 1 if it is negative.

Floating-point primitives are float and double

2) boolean type primitive

encode the truth values true and false. Even booleans are in turn processed using int instructions.

3) returnAddress type primitive

returnAddress types are pointers to the opcodes of JVM instructions like jsr, ret, and jsr_w

Comments on "Java Primitive"

  1. Arttu says:

    Good to see people blogging about Java, keep it up! I’m always interested to learn new things.

  2. @sojant says:

    Just started reading your blog, nice articles. Kinda expected more on those returnAddress’s

  3. Arttu says:

    Me too, didn’t really get the idea of returnAddresses.

  4. Veera says:

    Is there any use case for the java developer using returnAddress type?

  5. shyamsundar says:

    Here explained that java primitives types are clearly explained and clear way of representation.And any of concept want to small program explanation….

    Thank you

  6. prem says:

    hi

    it is really bunch of knowledge 1 can learn from.

  7. WebDev says:

    Good Post. Want to know more about returnAddress with example.

  8. kkv says:

    it is mind-blowing….realy

  9. Praveen says:

    Didn’t get idea about returnAddress ????

  10. Anonymous says:

    ya plss do explain it in detail.

  11. Alpna says:

    Good Article.Hope to get more detailed info about return address

  12. Java Array says:

    […] in the above list, the primitives and reference types are treated differently. One popular cause of NullPointerException is accessing […]

  13. Nasir says:

    Quite impressed !

  14. Thanjavur @rvind $mart says:

    awesome explanation

  15. hukh says:

    difference between a primitive type and non-primitive type….?
    Note: i want reply form only joe… i don’t want to confuse myself with these discussions…
    pls…

  16. learner says:

    great post

  17. learner says:

    great post

  18. karthikeyan says:

    nice blog.. such a example i feel to better…

  19. Java String says:

    […] toString() is a method that belongs to Object class. Every wrapper classes implements toString() method which returns a String object of the passed primitive. […]

Comments are closed for "Java Primitive".