I manually added constructor, but still getting The constructor HttpResponseExtended() is undefined
public class HttpResponseExtended {
HttpResponse<String> response;
public HttpResponseExtended(HttpResponse<String> res) {
this.response = res;
}
public JSONObject json() {
return new JSONObject(response);
}
}
I’m creating new object with:
new HttpResponseExtended()
>Solution :
The constructor you defined takes an argument, try using:
new HttpResponseExtended(res);
Where res is of type HttpResponse<String>
If you want to instantiate the class without passing any argument, you need to define a constructor that doesn’t take any arguments.
public HttpResponseExtender() { }