how can I Use of "Object Class" to call methods of user-defined classes in java
<p>In these two classes I have passed an object of TestClassTwo in the getName method of TestClass from main method now I would like to call getTwoName method using an object obj. Can some one please help me with that. thanks
//  Below is the code 
//  class1</p>

<pre><code>package Test;

public class TestClassTwo {

    public static String getTwoName()
    {
        return "2nd";
    }

}
</code></pre>

<p>//  class2</p>

<p>package Test;</p>

<p>public class TestClass {</p>

<pre><code>public void getName(Object obj) throws InstantiationException, IllegalAccessException, ClassNotFoundException
{
    //  call getTwoName method of TestClassTwo using obj object
}
public static void main(String args[]) throws InstantiationException, IllegalAccessException, ClassNotFoundException
{
    TestClass tc=new TestClass();
    tc.getName(new TestClassTwo());
}
</code></pre>

<p>}</p>
