You need to locate the exact constructor for this. Class.newInstance()
can only be used to call the nullary constructor. So write
final Value v = Value.class.getConstructor(
int.class, int.class, double.class).newInstance(_xval1,_xval2,_pval);
More Related Contents:
- Java: newInstance of class that has no default constructor
- How to get the parameter names of an object’s constructors (reflection)? [duplicate]
- Instantiate a class object with constructor that accepts a string parameter?
- Java: accessing private constructor with type parameters
- Is it possible in java to create ‘blank’ instance of class without no-arg constructor using reflection?
- Why are my fields initialized to null or to the default value of zero when I’ve declared and initialized them in my class’ constructor?
- Leaking this in constructor warning
- Can I get information about the local variables using Java reflection?
- Retrieving the inherited attribute names/values using Java Reflection
- Why is Class.newInstance() “evil”?
- Can I call methods in constructor in Java?
- Is there something like instanceOf(Class c) in Java?
- Why is constructor of super class invoked when we declare the object of sub class? (Java)
- How to get annotations of a member variable?
- Horrendous performance & large heap footprint of Java 8 constructor reference?
- Java reflection: how to get field value from an object, not knowing its class
- Set field value with reflection
- Reflection for Class of generic parameter in Java?
- Dynamically find the class that represents a primitive Java type
- Calling virtual method in base class constructor
- Why are constructors not inherited in java?
- order of constructor calls in multilevel inheritance in java [duplicate]
- How to get annotation class name, attribute values using reflection
- Java introspection and reflection
- Java Spring bean with private constructor
- How can I improve performance of Field.set (perhap using MethodHandles)?
- Get jar version in runtime
- ElementType.LOCAL_VARIABLE annotation type
- Initialize final variable before constructor in Java
- Difference between a no-arg constructor and a default constructor in Java