What does Class mean in Java?












107














My question is as above. Sorry, it's probably a duplicate but I couldn't find an example with the <?> on the end.



Why would you not just use Class as the parameter?










share|improve this question
























  • en.wikipedia.org/wiki/Wildcard_%28Java%29
    – Anycorn
    Mar 29 '12 at 8:27










  • stackoverflow.com/q/2024513/1140748
    – alain.janinm
    Mar 29 '12 at 8:31
















107














My question is as above. Sorry, it's probably a duplicate but I couldn't find an example with the <?> on the end.



Why would you not just use Class as the parameter?










share|improve this question
























  • en.wikipedia.org/wiki/Wildcard_%28Java%29
    – Anycorn
    Mar 29 '12 at 8:27










  • stackoverflow.com/q/2024513/1140748
    – alain.janinm
    Mar 29 '12 at 8:31














107












107








107


33





My question is as above. Sorry, it's probably a duplicate but I couldn't find an example with the <?> on the end.



Why would you not just use Class as the parameter?










share|improve this question















My question is as above. Sorry, it's probably a duplicate but I couldn't find an example with the <?> on the end.



Why would you not just use Class as the parameter?







java syntax






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 4:35









LAD

1,9591720




1,9591720










asked Mar 29 '12 at 8:25









david99world

12.5k2294122




12.5k2294122












  • en.wikipedia.org/wiki/Wildcard_%28Java%29
    – Anycorn
    Mar 29 '12 at 8:27










  • stackoverflow.com/q/2024513/1140748
    – alain.janinm
    Mar 29 '12 at 8:31


















  • en.wikipedia.org/wiki/Wildcard_%28Java%29
    – Anycorn
    Mar 29 '12 at 8:27










  • stackoverflow.com/q/2024513/1140748
    – alain.janinm
    Mar 29 '12 at 8:31
















en.wikipedia.org/wiki/Wildcard_%28Java%29
– Anycorn
Mar 29 '12 at 8:27




en.wikipedia.org/wiki/Wildcard_%28Java%29
– Anycorn
Mar 29 '12 at 8:27












stackoverflow.com/q/2024513/1140748
– alain.janinm
Mar 29 '12 at 8:31




stackoverflow.com/q/2024513/1140748
– alain.janinm
Mar 29 '12 at 8:31












6 Answers
6






active

oldest

votes


















87














Class is a parametrizable class, hence you can use the syntax Class<T> where T is a type. By writing Class<?>, you're declaring a Class object which can be of any type (? is a wildcard). The Class type is a type that contains metainformation about a class.



It's always good practice to refer to a generic type by specifying his specific type, by using Class<?> you're respecting this practice (you're aware of Class to be parametrizable) but you're not restricting your parameter to have a specific type.



Reference about Generics and Wildcards: http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html



Reference about Class object and reflection (the feature of Java language used to introspect itself): http://java.sun.com/developer/technicalArticles/ALT/Reflection/






share|improve this answer

















  • 6




    What's the benefit of doing this over just simply using Class without a type? They seem to represent the same thing.
    – ashes999
    Jun 22 '13 at 14:47












  • I thought the whole point of a generic is you don't know the class type upfront. Otherwise you would just define a function to use a particular class type for the parameter. This question mark still doesn't make sense.
    – Brain2000
    Mar 6 '15 at 17:48








  • 3




    There is no other benefit except you're telling the compiler that "I know this is a generic class, but I don't know or care about the actual type, so instead of giving a concrete type I'm giving the ? wildcard.". If you don't give the wildcard, the compiler assumes that you either forgot the type or didn't know the class was generic and will warn you about it.
    – Kayaman
    Feb 29 '16 at 7:51






  • 1




    What's the Kotlin equivalent of Class<?>
    – JGuo
    Jun 14 '18 at 17:50












  • simply Class cannot be pass to a argument which type is Class<?>, So Class<?> is more convenient for all situation.
    – okwap
    Oct 5 '18 at 7:08



















55














This <?> is a beast. It often leads to confusion and errors, because, when you see it first, then you start believing, <?> is a wildcard for any java type. Which is .. not true. <?> is the unknown type, a slight and nasty difference.



It's not a problem when you use it with Class. Both lines work and compile:



Class anyType = String.class;
Class <?> theUnknownType = String.class;


But - if we start using it with collections, then we see strange compiletime errors:



List<?> list = new ArrayList<Object>();  // ArrayList<?> is not allowed
list.add("a String"); // doesn't compile ...


Our List<?> is not a collection, that is suitable for just any type of object. It can only store one type: the mystic "unkown type". Which is not a real type, for sure.






share|improve this answer





























    6














    It's a generics literal. It means that you don't know the type of class this Class instance is representing, but you are still using the generic version.




    • if you knew the class, you'd use Class<Foo>. That way you can create a new instance, for example, without casting: Foo foo = clazz.newInstance();

    • if you don't use generics at all, you'll get a warning at least (and not using generics is generally discouraged as it may lead to hard-to-detect side effects)






    share|improve this answer





























      6














      It means your Class reference can hold a reference to any Class object.



      It's basically the same as "Class" but you're showing other people who read your code that you didn't forget about generics, you just want a reference that can hold any Class object.



      Bruce Eckel, Thinking in Java:




      In Java SE5, Class<?> is preferred over plain Class, even though they
      are equivalent and the plain Class, as you saw, doesn’t produce a
      compiler warning. The benefit of Class<?> is that it
      indicates that you aren’t just using a non-specific class reference by
      accident, or out of ignorance. You chose the non-specific version.







      share|improve this answer



















      • 1




        The quote says "Class<?> is preferred over plain Class" and "The benefit of Class<?>". It seems blockquote doesn't agree with the angular brackets.
        – Filip
        Mar 29 '12 at 17:13










      • It needs to be escaped. Fixed it now :P
        – Sami Kuhmonen
        Feb 29 '16 at 7:08



















      4














      In generics, an unknown type is represented by the wildcard character "?". Read here for official example.






      share|improve this answer





























        3














        That means a Class with a type of anything (unknown).



        You should read java generics tutorial to get to understand it better






        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%2f9921676%2fwhat-does-class-mean-in-java%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          6 Answers
          6






          active

          oldest

          votes








          6 Answers
          6






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          87














          Class is a parametrizable class, hence you can use the syntax Class<T> where T is a type. By writing Class<?>, you're declaring a Class object which can be of any type (? is a wildcard). The Class type is a type that contains metainformation about a class.



          It's always good practice to refer to a generic type by specifying his specific type, by using Class<?> you're respecting this practice (you're aware of Class to be parametrizable) but you're not restricting your parameter to have a specific type.



          Reference about Generics and Wildcards: http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html



          Reference about Class object and reflection (the feature of Java language used to introspect itself): http://java.sun.com/developer/technicalArticles/ALT/Reflection/






          share|improve this answer

















          • 6




            What's the benefit of doing this over just simply using Class without a type? They seem to represent the same thing.
            – ashes999
            Jun 22 '13 at 14:47












          • I thought the whole point of a generic is you don't know the class type upfront. Otherwise you would just define a function to use a particular class type for the parameter. This question mark still doesn't make sense.
            – Brain2000
            Mar 6 '15 at 17:48








          • 3




            There is no other benefit except you're telling the compiler that "I know this is a generic class, but I don't know or care about the actual type, so instead of giving a concrete type I'm giving the ? wildcard.". If you don't give the wildcard, the compiler assumes that you either forgot the type or didn't know the class was generic and will warn you about it.
            – Kayaman
            Feb 29 '16 at 7:51






          • 1




            What's the Kotlin equivalent of Class<?>
            – JGuo
            Jun 14 '18 at 17:50












          • simply Class cannot be pass to a argument which type is Class<?>, So Class<?> is more convenient for all situation.
            – okwap
            Oct 5 '18 at 7:08
















          87














          Class is a parametrizable class, hence you can use the syntax Class<T> where T is a type. By writing Class<?>, you're declaring a Class object which can be of any type (? is a wildcard). The Class type is a type that contains metainformation about a class.



          It's always good practice to refer to a generic type by specifying his specific type, by using Class<?> you're respecting this practice (you're aware of Class to be parametrizable) but you're not restricting your parameter to have a specific type.



          Reference about Generics and Wildcards: http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html



          Reference about Class object and reflection (the feature of Java language used to introspect itself): http://java.sun.com/developer/technicalArticles/ALT/Reflection/






          share|improve this answer

















          • 6




            What's the benefit of doing this over just simply using Class without a type? They seem to represent the same thing.
            – ashes999
            Jun 22 '13 at 14:47












          • I thought the whole point of a generic is you don't know the class type upfront. Otherwise you would just define a function to use a particular class type for the parameter. This question mark still doesn't make sense.
            – Brain2000
            Mar 6 '15 at 17:48








          • 3




            There is no other benefit except you're telling the compiler that "I know this is a generic class, but I don't know or care about the actual type, so instead of giving a concrete type I'm giving the ? wildcard.". If you don't give the wildcard, the compiler assumes that you either forgot the type or didn't know the class was generic and will warn you about it.
            – Kayaman
            Feb 29 '16 at 7:51






          • 1




            What's the Kotlin equivalent of Class<?>
            – JGuo
            Jun 14 '18 at 17:50












          • simply Class cannot be pass to a argument which type is Class<?>, So Class<?> is more convenient for all situation.
            – okwap
            Oct 5 '18 at 7:08














          87












          87








          87






          Class is a parametrizable class, hence you can use the syntax Class<T> where T is a type. By writing Class<?>, you're declaring a Class object which can be of any type (? is a wildcard). The Class type is a type that contains metainformation about a class.



          It's always good practice to refer to a generic type by specifying his specific type, by using Class<?> you're respecting this practice (you're aware of Class to be parametrizable) but you're not restricting your parameter to have a specific type.



          Reference about Generics and Wildcards: http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html



          Reference about Class object and reflection (the feature of Java language used to introspect itself): http://java.sun.com/developer/technicalArticles/ALT/Reflection/






          share|improve this answer












          Class is a parametrizable class, hence you can use the syntax Class<T> where T is a type. By writing Class<?>, you're declaring a Class object which can be of any type (? is a wildcard). The Class type is a type that contains metainformation about a class.



          It's always good practice to refer to a generic type by specifying his specific type, by using Class<?> you're respecting this practice (you're aware of Class to be parametrizable) but you're not restricting your parameter to have a specific type.



          Reference about Generics and Wildcards: http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html



          Reference about Class object and reflection (the feature of Java language used to introspect itself): http://java.sun.com/developer/technicalArticles/ALT/Reflection/







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 29 '12 at 8:30









          manub

          2,87512030




          2,87512030








          • 6




            What's the benefit of doing this over just simply using Class without a type? They seem to represent the same thing.
            – ashes999
            Jun 22 '13 at 14:47












          • I thought the whole point of a generic is you don't know the class type upfront. Otherwise you would just define a function to use a particular class type for the parameter. This question mark still doesn't make sense.
            – Brain2000
            Mar 6 '15 at 17:48








          • 3




            There is no other benefit except you're telling the compiler that "I know this is a generic class, but I don't know or care about the actual type, so instead of giving a concrete type I'm giving the ? wildcard.". If you don't give the wildcard, the compiler assumes that you either forgot the type or didn't know the class was generic and will warn you about it.
            – Kayaman
            Feb 29 '16 at 7:51






          • 1




            What's the Kotlin equivalent of Class<?>
            – JGuo
            Jun 14 '18 at 17:50












          • simply Class cannot be pass to a argument which type is Class<?>, So Class<?> is more convenient for all situation.
            – okwap
            Oct 5 '18 at 7:08














          • 6




            What's the benefit of doing this over just simply using Class without a type? They seem to represent the same thing.
            – ashes999
            Jun 22 '13 at 14:47












          • I thought the whole point of a generic is you don't know the class type upfront. Otherwise you would just define a function to use a particular class type for the parameter. This question mark still doesn't make sense.
            – Brain2000
            Mar 6 '15 at 17:48








          • 3




            There is no other benefit except you're telling the compiler that "I know this is a generic class, but I don't know or care about the actual type, so instead of giving a concrete type I'm giving the ? wildcard.". If you don't give the wildcard, the compiler assumes that you either forgot the type or didn't know the class was generic and will warn you about it.
            – Kayaman
            Feb 29 '16 at 7:51






          • 1




            What's the Kotlin equivalent of Class<?>
            – JGuo
            Jun 14 '18 at 17:50












          • simply Class cannot be pass to a argument which type is Class<?>, So Class<?> is more convenient for all situation.
            – okwap
            Oct 5 '18 at 7:08








          6




          6




          What's the benefit of doing this over just simply using Class without a type? They seem to represent the same thing.
          – ashes999
          Jun 22 '13 at 14:47






          What's the benefit of doing this over just simply using Class without a type? They seem to represent the same thing.
          – ashes999
          Jun 22 '13 at 14:47














          I thought the whole point of a generic is you don't know the class type upfront. Otherwise you would just define a function to use a particular class type for the parameter. This question mark still doesn't make sense.
          – Brain2000
          Mar 6 '15 at 17:48






          I thought the whole point of a generic is you don't know the class type upfront. Otherwise you would just define a function to use a particular class type for the parameter. This question mark still doesn't make sense.
          – Brain2000
          Mar 6 '15 at 17:48






          3




          3




          There is no other benefit except you're telling the compiler that "I know this is a generic class, but I don't know or care about the actual type, so instead of giving a concrete type I'm giving the ? wildcard.". If you don't give the wildcard, the compiler assumes that you either forgot the type or didn't know the class was generic and will warn you about it.
          – Kayaman
          Feb 29 '16 at 7:51




          There is no other benefit except you're telling the compiler that "I know this is a generic class, but I don't know or care about the actual type, so instead of giving a concrete type I'm giving the ? wildcard.". If you don't give the wildcard, the compiler assumes that you either forgot the type or didn't know the class was generic and will warn you about it.
          – Kayaman
          Feb 29 '16 at 7:51




          1




          1




          What's the Kotlin equivalent of Class<?>
          – JGuo
          Jun 14 '18 at 17:50






          What's the Kotlin equivalent of Class<?>
          – JGuo
          Jun 14 '18 at 17:50














          simply Class cannot be pass to a argument which type is Class<?>, So Class<?> is more convenient for all situation.
          – okwap
          Oct 5 '18 at 7:08




          simply Class cannot be pass to a argument which type is Class<?>, So Class<?> is more convenient for all situation.
          – okwap
          Oct 5 '18 at 7:08













          55














          This <?> is a beast. It often leads to confusion and errors, because, when you see it first, then you start believing, <?> is a wildcard for any java type. Which is .. not true. <?> is the unknown type, a slight and nasty difference.



          It's not a problem when you use it with Class. Both lines work and compile:



          Class anyType = String.class;
          Class <?> theUnknownType = String.class;


          But - if we start using it with collections, then we see strange compiletime errors:



          List<?> list = new ArrayList<Object>();  // ArrayList<?> is not allowed
          list.add("a String"); // doesn't compile ...


          Our List<?> is not a collection, that is suitable for just any type of object. It can only store one type: the mystic "unkown type". Which is not a real type, for sure.






          share|improve this answer


























            55














            This <?> is a beast. It often leads to confusion and errors, because, when you see it first, then you start believing, <?> is a wildcard for any java type. Which is .. not true. <?> is the unknown type, a slight and nasty difference.



            It's not a problem when you use it with Class. Both lines work and compile:



            Class anyType = String.class;
            Class <?> theUnknownType = String.class;


            But - if we start using it with collections, then we see strange compiletime errors:



            List<?> list = new ArrayList<Object>();  // ArrayList<?> is not allowed
            list.add("a String"); // doesn't compile ...


            Our List<?> is not a collection, that is suitable for just any type of object. It can only store one type: the mystic "unkown type". Which is not a real type, for sure.






            share|improve this answer
























              55












              55








              55






              This <?> is a beast. It often leads to confusion and errors, because, when you see it first, then you start believing, <?> is a wildcard for any java type. Which is .. not true. <?> is the unknown type, a slight and nasty difference.



              It's not a problem when you use it with Class. Both lines work and compile:



              Class anyType = String.class;
              Class <?> theUnknownType = String.class;


              But - if we start using it with collections, then we see strange compiletime errors:



              List<?> list = new ArrayList<Object>();  // ArrayList<?> is not allowed
              list.add("a String"); // doesn't compile ...


              Our List<?> is not a collection, that is suitable for just any type of object. It can only store one type: the mystic "unkown type". Which is not a real type, for sure.






              share|improve this answer












              This <?> is a beast. It often leads to confusion and errors, because, when you see it first, then you start believing, <?> is a wildcard for any java type. Which is .. not true. <?> is the unknown type, a slight and nasty difference.



              It's not a problem when you use it with Class. Both lines work and compile:



              Class anyType = String.class;
              Class <?> theUnknownType = String.class;


              But - if we start using it with collections, then we see strange compiletime errors:



              List<?> list = new ArrayList<Object>();  // ArrayList<?> is not allowed
              list.add("a String"); // doesn't compile ...


              Our List<?> is not a collection, that is suitable for just any type of object. It can only store one type: the mystic "unkown type". Which is not a real type, for sure.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 29 '12 at 8:55









              Andreas_D

              95.1k11144231




              95.1k11144231























                  6














                  It's a generics literal. It means that you don't know the type of class this Class instance is representing, but you are still using the generic version.




                  • if you knew the class, you'd use Class<Foo>. That way you can create a new instance, for example, without casting: Foo foo = clazz.newInstance();

                  • if you don't use generics at all, you'll get a warning at least (and not using generics is generally discouraged as it may lead to hard-to-detect side effects)






                  share|improve this answer


























                    6














                    It's a generics literal. It means that you don't know the type of class this Class instance is representing, but you are still using the generic version.




                    • if you knew the class, you'd use Class<Foo>. That way you can create a new instance, for example, without casting: Foo foo = clazz.newInstance();

                    • if you don't use generics at all, you'll get a warning at least (and not using generics is generally discouraged as it may lead to hard-to-detect side effects)






                    share|improve this answer
























                      6












                      6








                      6






                      It's a generics literal. It means that you don't know the type of class this Class instance is representing, but you are still using the generic version.




                      • if you knew the class, you'd use Class<Foo>. That way you can create a new instance, for example, without casting: Foo foo = clazz.newInstance();

                      • if you don't use generics at all, you'll get a warning at least (and not using generics is generally discouraged as it may lead to hard-to-detect side effects)






                      share|improve this answer












                      It's a generics literal. It means that you don't know the type of class this Class instance is representing, but you are still using the generic version.




                      • if you knew the class, you'd use Class<Foo>. That way you can create a new instance, for example, without casting: Foo foo = clazz.newInstance();

                      • if you don't use generics at all, you'll get a warning at least (and not using generics is generally discouraged as it may lead to hard-to-detect side effects)







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Mar 29 '12 at 8:27









                      Bozho

                      482k1079421059




                      482k1079421059























                          6














                          It means your Class reference can hold a reference to any Class object.



                          It's basically the same as "Class" but you're showing other people who read your code that you didn't forget about generics, you just want a reference that can hold any Class object.



                          Bruce Eckel, Thinking in Java:




                          In Java SE5, Class<?> is preferred over plain Class, even though they
                          are equivalent and the plain Class, as you saw, doesn’t produce a
                          compiler warning. The benefit of Class<?> is that it
                          indicates that you aren’t just using a non-specific class reference by
                          accident, or out of ignorance. You chose the non-specific version.







                          share|improve this answer



















                          • 1




                            The quote says "Class<?> is preferred over plain Class" and "The benefit of Class<?>". It seems blockquote doesn't agree with the angular brackets.
                            – Filip
                            Mar 29 '12 at 17:13










                          • It needs to be escaped. Fixed it now :P
                            – Sami Kuhmonen
                            Feb 29 '16 at 7:08
















                          6














                          It means your Class reference can hold a reference to any Class object.



                          It's basically the same as "Class" but you're showing other people who read your code that you didn't forget about generics, you just want a reference that can hold any Class object.



                          Bruce Eckel, Thinking in Java:




                          In Java SE5, Class<?> is preferred over plain Class, even though they
                          are equivalent and the plain Class, as you saw, doesn’t produce a
                          compiler warning. The benefit of Class<?> is that it
                          indicates that you aren’t just using a non-specific class reference by
                          accident, or out of ignorance. You chose the non-specific version.







                          share|improve this answer



















                          • 1




                            The quote says "Class<?> is preferred over plain Class" and "The benefit of Class<?>". It seems blockquote doesn't agree with the angular brackets.
                            – Filip
                            Mar 29 '12 at 17:13










                          • It needs to be escaped. Fixed it now :P
                            – Sami Kuhmonen
                            Feb 29 '16 at 7:08














                          6












                          6








                          6






                          It means your Class reference can hold a reference to any Class object.



                          It's basically the same as "Class" but you're showing other people who read your code that you didn't forget about generics, you just want a reference that can hold any Class object.



                          Bruce Eckel, Thinking in Java:




                          In Java SE5, Class<?> is preferred over plain Class, even though they
                          are equivalent and the plain Class, as you saw, doesn’t produce a
                          compiler warning. The benefit of Class<?> is that it
                          indicates that you aren’t just using a non-specific class reference by
                          accident, or out of ignorance. You chose the non-specific version.







                          share|improve this answer














                          It means your Class reference can hold a reference to any Class object.



                          It's basically the same as "Class" but you're showing other people who read your code that you didn't forget about generics, you just want a reference that can hold any Class object.



                          Bruce Eckel, Thinking in Java:




                          In Java SE5, Class<?> is preferred over plain Class, even though they
                          are equivalent and the plain Class, as you saw, doesn’t produce a
                          compiler warning. The benefit of Class<?> is that it
                          indicates that you aren’t just using a non-specific class reference by
                          accident, or out of ignorance. You chose the non-specific version.








                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Feb 29 '16 at 7:08









                          Sami Kuhmonen

                          20.8k73148




                          20.8k73148










                          answered Mar 29 '12 at 8:28









                          Filip

                          998515




                          998515








                          • 1




                            The quote says "Class<?> is preferred over plain Class" and "The benefit of Class<?>". It seems blockquote doesn't agree with the angular brackets.
                            – Filip
                            Mar 29 '12 at 17:13










                          • It needs to be escaped. Fixed it now :P
                            – Sami Kuhmonen
                            Feb 29 '16 at 7:08














                          • 1




                            The quote says "Class<?> is preferred over plain Class" and "The benefit of Class<?>". It seems blockquote doesn't agree with the angular brackets.
                            – Filip
                            Mar 29 '12 at 17:13










                          • It needs to be escaped. Fixed it now :P
                            – Sami Kuhmonen
                            Feb 29 '16 at 7:08








                          1




                          1




                          The quote says "Class<?> is preferred over plain Class" and "The benefit of Class<?>". It seems blockquote doesn't agree with the angular brackets.
                          – Filip
                          Mar 29 '12 at 17:13




                          The quote says "Class<?> is preferred over plain Class" and "The benefit of Class<?>". It seems blockquote doesn't agree with the angular brackets.
                          – Filip
                          Mar 29 '12 at 17:13












                          It needs to be escaped. Fixed it now :P
                          – Sami Kuhmonen
                          Feb 29 '16 at 7:08




                          It needs to be escaped. Fixed it now :P
                          – Sami Kuhmonen
                          Feb 29 '16 at 7:08











                          4














                          In generics, an unknown type is represented by the wildcard character "?". Read here for official example.






                          share|improve this answer


























                            4














                            In generics, an unknown type is represented by the wildcard character "?". Read here for official example.






                            share|improve this answer
























                              4












                              4








                              4






                              In generics, an unknown type is represented by the wildcard character "?". Read here for official example.






                              share|improve this answer












                              In generics, an unknown type is represented by the wildcard character "?". Read here for official example.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Mar 29 '12 at 8:30









                              Jasonw

                              4,77173141




                              4,77173141























                                  3














                                  That means a Class with a type of anything (unknown).



                                  You should read java generics tutorial to get to understand it better






                                  share|improve this answer




























                                    3














                                    That means a Class with a type of anything (unknown).



                                    You should read java generics tutorial to get to understand it better






                                    share|improve this answer


























                                      3












                                      3








                                      3






                                      That means a Class with a type of anything (unknown).



                                      You should read java generics tutorial to get to understand it better






                                      share|improve this answer














                                      That means a Class with a type of anything (unknown).



                                      You should read java generics tutorial to get to understand it better







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Sep 21 '16 at 17:56









                                      Matt

                                      62k18118159




                                      62k18118159










                                      answered Mar 29 '12 at 8:28









                                      fmucar

                                      12.1k13948




                                      12.1k13948






























                                          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.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • 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%2f9921676%2fwhat-does-class-mean-in-java%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

                                          Xamarin.iOS Cant Deploy on Iphone

                                          Glorious Revolution

                                          Dulmage-Mendelsohn matrix decomposition in Python