Monday, 5 September 2011

Use of getClass() in java

class MyClass extends Object
{
    public void showClassName()
    {
        System.out.println("Class is : " + getClass());
    }
}


public class UseMethods extends MyClass
{
    public void callMethods()
    {
        System.out.println("Class is : " + getClass());
    }
   
    public static void main(String[] args)
    {
            new UseMethods().callMethods();
     }
}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.