Why we give class literals of annotation to the getAnnotation method? For example I want to get the class annotation and put Annotation preceding the Class.
@interface MyAnno {
String str();
int val();
}
class JavaApplication22 {
Why I can't get the annotation of the Class with second method?How class literals work in this situation?
MyAnno anno = m.getAnnotation(MyAnno.class); //First Method
MyAnno anno = m.getAnnotation(MyAnno); //Second Method