By using Class.forName (), we can get in three ways:
- Class.forName(“c. test”);
‘C’ object of java.lang.class representing the class test.
- By using getClass() of java.lang.Object
Test t=new test ();
Class c=t. getClass ();
Here c is the object java.lang.class representing class test
- By using .class keyword
Class c= String .class;
C represents java.lang.String class
Class c=test. Class
C represents java.lang test class
No comments:
Post a Comment