What does it mean?
If I have something like:
SessionFactory.class.getName();
in hibernate.
what is the purpose of writtingClassname.class.staticMethod();
And why to use keywordclass within Class & method?
Please Answer!
If I have something like:
SessionFactory.class.getName();
in hibernate.
what is the purpose of writtingClassname.class.staticMethod();
And why to use keywordclass within Class & method?
Please Answer!
Classes that exist in your runtime environment each have an instance of java.lang.Class, which carries some metadata about that class, such as what methods and fields it defines. You can obtain this object in a number of ways, one of which is via the static (compile-time) .class operator. It's useful for many reasons, such as reflection
getName is an instance method of java.lang.Class, not - as you seem to think - a static method of SessionFactory. SessionFactory.class.getName will return the name of that class, which is something like org.hibernate.session.SessionFactory ( a complete guess, by the way, but you get the idea )