You need to sign in to do that
Don't have an account?
Nikhil M Kumar
How can I use the Constructor of a Wrapper outside it (in the Main Class) ?
I have defined a Wrapper class inside a Main class.
When I try to use the Constructor of the Wrappe class outside the Wrapper class (except in Main Class Constructor), an error shows up as below:
When I try to use the Constructor of the Wrappe class outside the Wrapper class (except in Main Class Constructor), an error shows up as below:
Constructor not defined: [JSONParserUtil.JSONParserUtilWrapper].<Constructor>()What can I do, so as to use the Wrapper class's Constructor in other methods of the Main class?
I just got it solved.. The problem is that the Constructor should be defined just like it was defined inside the Wrapper class (with the same type and number of parameters).
For example, if you have defined it initially as:
Then, you should use it the same way unless you have defined another constructor with different type and number of parameters or no parameters (depending on your requierement), which is also popularly called as "Overloading"!!
And, Thank you Devi, for seeking out to help!
All Answers
can you post your code here
I just got it solved.. The problem is that the Constructor should be defined just like it was defined inside the Wrapper class (with the same type and number of parameters).
For example, if you have defined it initially as:
Then, you should use it the same way unless you have defined another constructor with different type and number of parameters or no parameters (depending on your requierement), which is also popularly called as "Overloading"!!
And, Thank you Devi, for seeking out to help!