If the class is not found in Class.forname("") then only a runtime exception is raised. But if foo() is not found a compile time exception occurs as well...
ambadas
Sep 8th, 2006
Class.forname("xxxx") will returns the xxxx object after the xxxx class is loaded otherwise it will throw the exception. But new Foo() will creates the object of Foo() when the if there is Foo class is available means it doesn't require the Foo class to be loaded
1)when the application is stopped2)when a class is replaced with the new class3)when there is no memory to operate.
Manish
Oct 3rd, 2006
public void destroy() Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. This method is only called once all threads within the servlet's servi...
Static methods cannot be overridden because method overriding only occurs in the context of dynamic (i.e. runtime) lookup of methods. Static methods (by their name) are looked up statically (i.e. at c...
Ramesh
Feb 4th, 2016
If a subclass defines a class method with the same signature as a class method in the superclass, the method in the subclass hides the one in the superclass. You didn't override the method a(), because static methods are not inherited. If you had put @Override, you would have seen an error.
We cant call parameterized constructors by using newInstance() method. Bcoz, newInstance() method will use default constructor to create an object of a class.Ex:public class Sample {}if we write ...
try{System.out.println("class name is "+class_name);Class cls=Class.forName(class_name);Constructor[] ctorlist=cls.getConstructors();/**temporary remove the sysout statement***//** to go to the list b...
then how can i call a userDefine constructor i mean parameterised constructor?">
if i am Instantiating a class using "(Abc)Class.forName("Abc").newInstance()"then how can i call a userDefine constructor i mean parameterised constructor?