Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to instantiate a class  RSS feed

 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!