I need to pass a setter value (set by jbpm call) to a contructor in Java. Is it possible? JBPM calls a constructor with no arguments. So my only way out is to set that value and pass it as a parameter to contructor? Thanks.
Asked
Active
Viewed 144 times
1 Answers
0
You need to look at the concept of Parametrized constructor. You can create a object using the parametrized constructor and call the default one from it, like
class MainClass {
String name;
public MainClass(){
System.out.println("In default constructor");
}
public MainClass(String name) {
this();
System.out.println("In constructor with a String");
}
}

mtk
- 13,221
- 16
- 72
- 112