I dont know this might be something very simple...
so please excuse me.

I have the following small code.

public class saby {

        public static void main(String args[])
        {

                String s = "myclass";
                Class c = new Class();
                try {

                         c  = Class.forName(s);

                Object b = c.newInstance();
                b.method();   // I know this is an error..so what to do?
                }

                catch (Exception e) {
                }
        }
}

// myclass.java

public class myclass {

public void method()
{
        System.out.println("hello world");
}
}

Now I get the compilation error that method is not there in Object.
So now if I want to call the method of the newly created instance
what should I do...




----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to