No. You're a newbie, you don't need to know about that, and if you did know about that I guarantee you you'd abuse it, it would distract you from learning the basics, and you wouldn't fully understand it anyway. Some other clown is guaranteed to tell you, but I implore you to ignore this feature for now, it will only hinder your learning process, and more importantly you won't have the skills to debug reflective code, which is notoriously awkward to do
Learn to walk before you try running. Even experienced developers badly screw things up using reflection
> Thank you very much for the reply.
>
> But this is the exercise I have to do. I started
> learning JAVA since 15 days. Even if this is
> difficult, I ll try to grab whatever possible. Please
> gimme a very simple example or good links.
>
> Thanks again,
> Basav
Fair enough. Don't say I didn't warn you
Class clazz = Class.forName("com.mydomain.myapp.MyClass";
Object obj = clazz.newInstance();
Method performAction = clazz.getDeclaredMethod("doSomething", new Class[0] );
Object result = performAction.invoke(obj, new Object[0]);
Don't bother asking for any explanation of what it means, or for any help when it doesn't work. You've been coding a whole 15 days, you're obviously ready for this by now, and should know exactly what it's all about and how to fix any problems that arise
> Thank you!!!
Don't bother thanking me. Despite what you think, I haven't done you any favours. You're going to use this technique in wholly inappropriate places from now on, because it's shiny and fangled. You'll be back shortly asking 50 questions about what's going wrong, and the next guy will say "why are you using reflection for this?" and you won't be able to say
You really ought not to bother with this API yet