java - instantiate class from class object -


In Java, can I use a class object to start dynamically those types of classes?

i.e. I need some functions like this.

  object foo (class type) {// returns new object type 'type'}  

You can use:

  throws the object foo (class type) InstantiationException, IllegalAccessException {return type.newInstance (); }  

... but it assumes that the zero-logic constructor is to go through a more robust route or, which takes you into using the reflection stuff in the package.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -