Home  >  Forum  >  Core Java
Post New Query

use of getClass() method in java



Asked on March 22, 2015
what is the use of getClass() method in java


Replied on March 29, 2015
getClass() method return the class name of your java program. See the example  that return the class name...

public class GetClassNameMethodTest {
public static void main(String[] args) {
GetClassNameMethodTest c= new GetClassNameMethodTest();
System.out.println(c.getClass());
}
}

Output: GetClassNameMethodTest



Write Answer







©2019 concretepage.com | Privacy Policy | Contact Us