The class type dynamically assigned to the variableHow does array class work in Java?Java inner class and static nested classFastest way to determine if an integer's square root is an integerJava Class that implements Map and keeps insertion order?Where does the @Transactional annotation belong?How to get a class instance of generics type TDifference between <context:annotation-config> vs <context:component-scan>Error: Could not find or load main classStatic Classes In JavaWhy don't Java's +=, -=, *=, /= compound assignment operators require casting?Is not an enclosing class Java

How to compare two different formulations of a problem?

Why aren't RCS openings an issue for spacecraft heat shields?

In the MCU, why does Mjölnir retain its enchantments after Ragnarok?

Most practical knots for hitching a line to an object while keeping the bitter end as tight as possible, without sag?

What does it mean to have a subnet mask /32?

Are illustrations in novels frowned upon?

If the first law of thermodynamics ensures conservation of energy, why does it allow systems to lose energy?

Shouldn't the "credit score" prevent Americans from going deeper and deeper into personal debt?

Can pay be witheld for hours cleaning up after closing time?

What is the hex versus octal timeline?

Is it appropriate for a prospective landlord to ask me for my credit report?

If all stars rotate, why was there a theory developed, that requires non-rotating stars?

Is it possible to create a golf ball sized star?

Efficiently pathfinding many flocking enemies around obstacles

Co-author responds to email by mistake cc'ing the EiC

Can I switch to third-person while not in 'town' in Destiny 2?

Why is observed clock rate < 3MHz on Arduino Uno?

The teacher logged me in as administrator for doing a short task, is the whole system now compromised?

Is it safe to remove the bottom chords of a series of garage roof trusses?

If I have a 16.67% fail rate (N=24) & I do another 24 tests, what is the likelihood that I get 0 fails by chance?

Science fiction short story where aliens contact a drunk about Earth's impending destruction

Why is 日本 read as "nihon" but not "nitsuhon"?

Verb form to finish someone else's sentence?

Avoiding racist tropes in fantasy



The class type dynamically assigned to the variable


How does array class work in Java?Java inner class and static nested classFastest way to determine if an integer's square root is an integerJava Class that implements Map and keeps insertion order?Where does the @Transactional annotation belong?How to get a class instance of generics type TDifference between <context:annotation-config> vs <context:component-scan>Error: Could not find or load main classStatic Classes In JavaWhy don't Java's +=, -=, *=, /= compound assignment operators require casting?Is not an enclosing class Java






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm wrapping an Axis web service in a Springboot microservice and stumbled on some code that does not make sense.



Class cls = AmountInfo[].class;


What class is returned above ?










share|improve this question


























  • Possible duplicate of How does array class work in Java?

    – vincrichaud
    Mar 27 at 16:08











  • That's what would be called the AmountInfo array class, and that's different from the class of AmountInfo

    – ernest_k
    Mar 27 at 16:09











  • By the way int.class is an other exotic class.

    – Joop Eggen
    Mar 27 at 16:10











  • "What class is returned above" - why did not you call "System.out.println(cls.getName())"?

    – Alexei Kaigorodov
    Mar 27 at 17:18

















2















I'm wrapping an Axis web service in a Springboot microservice and stumbled on some code that does not make sense.



Class cls = AmountInfo[].class;


What class is returned above ?










share|improve this question


























  • Possible duplicate of How does array class work in Java?

    – vincrichaud
    Mar 27 at 16:08











  • That's what would be called the AmountInfo array class, and that's different from the class of AmountInfo

    – ernest_k
    Mar 27 at 16:09











  • By the way int.class is an other exotic class.

    – Joop Eggen
    Mar 27 at 16:10











  • "What class is returned above" - why did not you call "System.out.println(cls.getName())"?

    – Alexei Kaigorodov
    Mar 27 at 17:18













2












2








2








I'm wrapping an Axis web service in a Springboot microservice and stumbled on some code that does not make sense.



Class cls = AmountInfo[].class;


What class is returned above ?










share|improve this question
















I'm wrapping an Axis web service in a Springboot microservice and stumbled on some code that does not make sense.



Class cls = AmountInfo[].class;


What class is returned above ?







java compilation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 16:07









ernest_k

27k4 gold badges32 silver badges55 bronze badges




27k4 gold badges32 silver badges55 bronze badges










asked Mar 27 at 16:06









VankuisherVankuisher

966 bronze badges




966 bronze badges















  • Possible duplicate of How does array class work in Java?

    – vincrichaud
    Mar 27 at 16:08











  • That's what would be called the AmountInfo array class, and that's different from the class of AmountInfo

    – ernest_k
    Mar 27 at 16:09











  • By the way int.class is an other exotic class.

    – Joop Eggen
    Mar 27 at 16:10











  • "What class is returned above" - why did not you call "System.out.println(cls.getName())"?

    – Alexei Kaigorodov
    Mar 27 at 17:18

















  • Possible duplicate of How does array class work in Java?

    – vincrichaud
    Mar 27 at 16:08











  • That's what would be called the AmountInfo array class, and that's different from the class of AmountInfo

    – ernest_k
    Mar 27 at 16:09











  • By the way int.class is an other exotic class.

    – Joop Eggen
    Mar 27 at 16:10











  • "What class is returned above" - why did not you call "System.out.println(cls.getName())"?

    – Alexei Kaigorodov
    Mar 27 at 17:18
















Possible duplicate of How does array class work in Java?

– vincrichaud
Mar 27 at 16:08





Possible duplicate of How does array class work in Java?

– vincrichaud
Mar 27 at 16:08













That's what would be called the AmountInfo array class, and that's different from the class of AmountInfo

– ernest_k
Mar 27 at 16:09





That's what would be called the AmountInfo array class, and that's different from the class of AmountInfo

– ernest_k
Mar 27 at 16:09













By the way int.class is an other exotic class.

– Joop Eggen
Mar 27 at 16:10





By the way int.class is an other exotic class.

– Joop Eggen
Mar 27 at 16:10













"What class is returned above" - why did not you call "System.out.println(cls.getName())"?

– Alexei Kaigorodov
Mar 27 at 17:18





"What class is returned above" - why did not you call "System.out.println(cls.getName())"?

– Alexei Kaigorodov
Mar 27 at 17:18












1 Answer
1






active

oldest

votes


















1













Here's what the docs of java.lang.Class have to say about this:




Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions.




Just as the a Class object for the type AmountInfo, there is a Class for the array 1D array type AmountInfo[], just as there is also a type for the 2D array type AmountInfo[][], etc.



A Class of an array type returns true when isArray() is invoked on it. AmountInfo[].class is equivalent to AmountInfo.class.arrayType(). And you can use it with the reflection API the same way you can use a normal class (example below):



//Creating a 1D array of AmountInfo type
jshell> Array.newInstance(AmountInfo.class, 2)
$65 ==> AmountInfo[2] null, null

// Creating a 2D array of AmountInfo type
jshell> Array.newInstance(AmountInfo[].class, 2)
$66 ==> AmountInfo[2][] null, null





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381735%2fthe-class-type-dynamically-assigned-to-the-variable%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1













    Here's what the docs of java.lang.Class have to say about this:




    Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions.




    Just as the a Class object for the type AmountInfo, there is a Class for the array 1D array type AmountInfo[], just as there is also a type for the 2D array type AmountInfo[][], etc.



    A Class of an array type returns true when isArray() is invoked on it. AmountInfo[].class is equivalent to AmountInfo.class.arrayType(). And you can use it with the reflection API the same way you can use a normal class (example below):



    //Creating a 1D array of AmountInfo type
    jshell> Array.newInstance(AmountInfo.class, 2)
    $65 ==> AmountInfo[2] null, null

    // Creating a 2D array of AmountInfo type
    jshell> Array.newInstance(AmountInfo[].class, 2)
    $66 ==> AmountInfo[2][] null, null





    share|improve this answer





























      1













      Here's what the docs of java.lang.Class have to say about this:




      Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions.




      Just as the a Class object for the type AmountInfo, there is a Class for the array 1D array type AmountInfo[], just as there is also a type for the 2D array type AmountInfo[][], etc.



      A Class of an array type returns true when isArray() is invoked on it. AmountInfo[].class is equivalent to AmountInfo.class.arrayType(). And you can use it with the reflection API the same way you can use a normal class (example below):



      //Creating a 1D array of AmountInfo type
      jshell> Array.newInstance(AmountInfo.class, 2)
      $65 ==> AmountInfo[2] null, null

      // Creating a 2D array of AmountInfo type
      jshell> Array.newInstance(AmountInfo[].class, 2)
      $66 ==> AmountInfo[2][] null, null





      share|improve this answer



























        1












        1








        1







        Here's what the docs of java.lang.Class have to say about this:




        Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions.




        Just as the a Class object for the type AmountInfo, there is a Class for the array 1D array type AmountInfo[], just as there is also a type for the 2D array type AmountInfo[][], etc.



        A Class of an array type returns true when isArray() is invoked on it. AmountInfo[].class is equivalent to AmountInfo.class.arrayType(). And you can use it with the reflection API the same way you can use a normal class (example below):



        //Creating a 1D array of AmountInfo type
        jshell> Array.newInstance(AmountInfo.class, 2)
        $65 ==> AmountInfo[2] null, null

        // Creating a 2D array of AmountInfo type
        jshell> Array.newInstance(AmountInfo[].class, 2)
        $66 ==> AmountInfo[2][] null, null





        share|improve this answer













        Here's what the docs of java.lang.Class have to say about this:




        Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions.




        Just as the a Class object for the type AmountInfo, there is a Class for the array 1D array type AmountInfo[], just as there is also a type for the 2D array type AmountInfo[][], etc.



        A Class of an array type returns true when isArray() is invoked on it. AmountInfo[].class is equivalent to AmountInfo.class.arrayType(). And you can use it with the reflection API the same way you can use a normal class (example below):



        //Creating a 1D array of AmountInfo type
        jshell> Array.newInstance(AmountInfo.class, 2)
        $65 ==> AmountInfo[2] null, null

        // Creating a 2D array of AmountInfo type
        jshell> Array.newInstance(AmountInfo[].class, 2)
        $66 ==> AmountInfo[2][] null, null






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 16:31









        ernest_kernest_k

        27k4 gold badges32 silver badges55 bronze badges




        27k4 gold badges32 silver badges55 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381735%2fthe-class-type-dynamically-assigned-to-the-variable%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현