Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to instantiate a class

 
priya kalyan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
is it possible to create an instance of a class, whose name is
stored in a string variable.
ie String s="trial";
//(it a class file stored in the working directory)
how can u create an instance of this trial class when the name is
stored in a String variable.
help me with an example if u can..
thank u,
priya
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Priya,
here is the code

run it and get back if any doubt
regards
Deekasha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic