I'm having trouble invoking methods on the objects returned from Class's forName method-how should I use Class.forName?

Ans : Invoke newInstance on the Class object returned by forName and then cast the resulting instance to a type that the compiler can access; only then can your program invoke a method on the instance of the newly loaded class. The forName method in class Class is a hidden gem in the Java system. This method lets your code create a new class type from a dynamic name—that is, a name given to your program as a string at run time.

What's particularly powerful about using forName is that neither you nor the compiler needs to know the exact details of the new class, only what superclass it extends or interfaces it implements. The forName method is what enables a Java-capable browser, for instance, to load arbitrary applets, even though the browser can't know in advance what Applet subclasses it will be called on to create. The forName method takes a String argument as the name of a class, and attempts to create a binary representation for a class with that name.

(This process is called ... more.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions