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 7592433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:54:18+00:00 2026-05-30T20:54:18+00:00

Why does (int 10) not produce an instance of type java.lang.Integer ? ; why

  • 0

Why does (int 10) not produce an instance of type java.lang.Integer?

; why Long here?
=> (type (int 10))
; java.lang.Long

; this one is also Long, why not java.lang.Number?
=> (type (num 10))
; java.lang.Long

=> (type (double 10))
; java.lang.Double
=> (type (long 10))
; java.lang.Long
=> (type (float 10))
; java.lang.Float
=> (type (short 10))
; java.lang.Short
=> (type (bigint 10))
; clojure.lang.BigInt
=> (type (bigdec 10))
; java.math.BigDecimal
=> (type (boolean 10))
; java.lang.Boolean
=> (type (char 10))
; java.lang.Character
=> (type (byte 10))
; java.lang.Byte
  • 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-05-30T20:54:19+00:00Added an answer on May 30, 2026 at 8:54 pm

    Clojure deals only with long integers internally. (int) is used to cast a long to an int for calling Java methods that expect an int argument.

    In this case (int 10) does indeed return a Java int, but Clojure then promotes the int back to a long. (type) uses (class) to find out the type of its argument (in this case), and therefore the long gets boxed into a java.lang.Long.

    You can produce java.lang.Integer by using one of the java.lang.Integer constructors or factory methods:

    user> (type (Integer. 10))
    java.lang.Integer
    
    user> (type (Integer/valueOf 10))
    java.lang.Integer
    
    user> (type (Integer/decode "10"))
    java.lang.Integer
    
    ...
    

    (num) will upcast its argument to the abstract class java.lang.Number, but (type) will return the actual type of its argument, i.e. java.lang.Long again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What does this error mean? Generic.h:25: error: 'Generic' is not a template type Here's
This compiles: int* p1; const int* p2; p2 = p1; This does not: vector<int*>
I am going crazy here. The following simple if-condition does not produce the right
I am having an error: Error 2 'int[]' does not contain a definition for
The following code does not compile: //int a = ... int? b = (int?)
Why does the statement (int)84 throw an exception and Convert.ToInt32(84) does not throw an
The below does not compile: Func<int, int> fac = n => (n <= 1)
Why does the following not give an error? for (int i=0; i<10; ++i) //
For example: sizeof(char*) returns 4. As does int* , long long* , everything that
Why does this code int (*g)(int); int (*h)(char); h = g; In C, give

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.