Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

when we write class.forName("any one class"); what happens
actually?what it will return?explain stepwise?

Answer Posted / paras

Class.forName("")loads that class in memory ,to create
instance we have to use newInstance()

string _path="classpath loc of class XYZ ex com.aa.ss.XYZ";

Object ob=Class.forName(_path).newInstance();;
((XYZ)ob).any_method_of_XYZ();

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by constant time complexity?

1235


Is string pool garbage collected?

1012


Can a constructor have different name than a class name in java?

1186


Can a top level class be private or protected?

1053


Is main a keyword in java?

971


Can a constructor be private and how are this() and super() method used with constructor?

996


How do you use spaces in java?

990


Is boolean a wrapper class in java?

1055


Describe different states of a thread.

998


Give me example of derived data types.

1145


Explain listiterator and methods in listiterator?

1013


What are user defined exceptions?

1038


How to add menushortcut to menu item?

998


What is the difference in between cpp and java? Can u explain in detail?

1091


What are the advantages and disadvantages of reference counting in garbage collection?

1025