-1

I working on a java Project,

My teacher sent me an example of a code and I saw something I don't know,

But his explanation wasn't the best.

Can someone explain to me more about Class?

When to use and why to use

  • check out this link http://stackoverflow.com/questions/462297/how-to-use-classt-in-java – Rudra Aug 09 '15 at 07:55

2 Answers2

3

Class<?> means any class type. For example, Integer.class is a type of Class<Integer>, Double.class is a type of Class<Double>.

If a type of variable is Class<?>, then the variable can be set to any class type.

Class<Integer> clazz = Integer.class (0)
Class<Integer> clazz = Double.class (x)
Class<?> clazz = Integer.class (0)
Class<?> clazz = Double.class (0)
taegeonum
  • 81
  • 1
  • 6
0
Class<?>[]

getClasses() 

Returns an array containing Class objects representing all the public classes and interfaces that are members of the class represented by this Class object.

From Oracle Documantation :

http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html

scarto
  • 94
  • 6