Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7729011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:51:41+00:00 2026-06-01T05:51:41+00:00

I understand what wrappers are, but from the documentation you seem to be able

  • 0

I understand what wrappers are, but from the documentation you seem to be able to get an instance of a Class object of type int. Does this return the wrapper or some sort of Class instance of int? Because it wouldn’t make sense if it did, due to generics and type erasure. Isn’t it true that you can only get Class instances of actual classes not primitives? When they say represent do they mean wrapper of something else?

Here is what the JavaDoc says, and why I’m confused

TYPE

public static final Class TYPE

    The Class instance representing the primitive type int.

    Since:
        JDK1.1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:51:43+00:00Added an answer on June 1, 2026 at 5:51 am

    Isn’t it true that you can only get Class instances of actual classes not primitives?

    Sort of.

    But sometimes you need to have some meta-data for “primitive integer”. For example when looking at the method signature. Then you get a Class[] for the parameters, and you somehow need to differentiate between public void test(Integer x) and public void test(int x).

    So to facilitate this, there are special Class instances for the primitive types.

    To take this a step further, there is even java.lang.Void.TYPE:

     Class<Void> x = void.class;
    

    Insightful Javadoc:

    /**
     * Determines if the specified <code>Class</code> object represents a
     * primitive type.
     *
     * <p> There are nine predefined <code>Class</code> objects to represent
     * the eight primitive types and void.  These are created by the Java
     * Virtual Machine, and have the same names as the primitive types that
     * they represent, namely <code>boolean</code>, <code>byte</code>,
     * <code>char</code>, <code>short</code>, <code>int</code>,
     * <code>long</code>, <code>float</code>, and <code>double</code>.
     *
     * <p> These objects may only be accessed via the following public static
     * final variables, and are the only <code>Class</code> objects for which
     * this method returns <code>true</code>.
     *
     * @return true if and only if this class represents a primitive type
     *
     * @see     java.lang.Boolean#TYPE
     * @see     java.lang.Character#TYPE
     * @see     java.lang.Byte#TYPE
     * @see     java.lang.Short#TYPE
     * @see     java.lang.Integer#TYPE
     * @see     java.lang.Long#TYPE
     * @see     java.lang.Float#TYPE
     * @see     java.lang.Double#TYPE
     * @see     java.lang.Void#TYPE
     * @since JDK1.1
     */
    public native boolean isPrimitive();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand what System.WeakReference does, but what I can't seem to grasp is a
It seems I don't understand something simple about Protocol Buffers, but this is very
In an effort to understand MVC 2 and attempt to get my company to
I was researching Scala DB frameworks/wrappers, and came across Gizzard, from Twitter. While I
I don't really understand windows UAC... I need for my program to be able
My app will let users cut out things from photos. They'll be able to
I understand how to use the WITH clause for recursive queries (!!), but I'm
So, I understand how the scalac compiler is different from javac - looking at
I am trying to access a C++ class and call its method from a
I wrote a class to parse bbcode but I have a problem when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.