Is Httpresponse String?
Solution 1:
That comment on your answer makes no sense at all to me. I also have no idea why you were down-voted, though really I don't think the question was worded well enough to be properly answered, but if you're really in doubt with something like this you can think through it logically by checking the docs.
Short answer:
HttpResponse is not a String.
Long answer:
The documentation for HttpClient.execute(string)
shows this as the method signature:
publicabstract HttpResponse execute(HttpUriRequest request)
So clearly execute
returns you an HttpResponse
.
Now if you go to the docs for HttpResponse
you find that HttpResponse
is an interface and includes methods such as the method you used in your answer: getStatusLine()
. Immediately you know that an interface isn't a String, so HttpResponse
isn't a String
, but in case you might think it's the other way and maybe String
implements HttpResponse
, it should be fairly obvious that String
doesn't have a method called getStatusLine()
and that it'd be ridiculous for something as generic as a String
to implement an interface to do with HTTP. If you really want to be sure, you can check the docs again and see that String
doesn't have getStatusLine()
and doesn't implement the interface HttpResponse
.
Post a Comment for "Is Httpresponse String?"