jeudi 9 avril 2015

Why class instance itself has no public constructor?

While reading Reflection API i got this "Every Java Type has a class Instance And the class instance itself has no public Constructor" .


Now this is really confusing for me. Because what i have read till now says . All classes have constructor even when we don't specify any, we get constructor by default (even if the class is static) once we create its instance. Can someone explain me this in simple word


(to show even static class has constructor)



public class Reader1 {
private int pageNumber;

private class ReaderName1{
public int getPage(){
return pageNumber;
}
}
static class ReaderFound{

}
}


using javap



class Reader1$ReaderFound {
Reader1$ReaderFound();
}





Aucun commentaire:

Enregistrer un commentaire