Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

what does "String.class" mean

843785Sep 17 2008 — edited Sep 17 2008
I was going thru some java examples on the net....This is a pgm to find the class name of an object.
Can anyone explain me wat does the statement Class clazz = String.class; do?
public class ClassName {
public static void main(String[] args) {

Class clazz = String.class;
System.out.println("Class Name: " + clazz.getName());
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 15 2008
Added on Sep 17 2008
5 comments
1,457 views