KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
for example: public class Test { public static void main(String[] args) throws Exception { Car c= (Car) Class.forName("Car").newInstance(); System.out.println(c.getName()); } } class Car { String name = "Default Car"; String getName(){return this.name;} } clear code. But, if I add constructor with params, some like this: public Car(String name) {this.name = name;} I see: java.lang.InstantiationException So, no I don't know, how pass constructor with params. Please, help.
Tags (comma-separated)
Save Edits
Cancel