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 are the differences between getting and load method?

1066


What is a java list?

1042


Is a copy constructor?

998


What are the different approaches to implement a function to generate a random number?

998


What is an immutable object? How do you create one in java?

1011


What are encapsulation, inheritance and polymorphism?

942


Does java allow default arguments?

945


What are multiple inheritances? Is it supported by java?

888


What are streams?

1058


What are filterstreams?

1017


What is java util collection?

999


is it possible to instantiate the math class?

967


What is the differences between heap and stack memory in java? Explain

927


What is boolean in java?

917


What is the method overriding?

1040