my dog learned polymorphism*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes About HttpURLConnection's setDoInput Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "About HttpURLConnection Watch "About HttpURLConnection New topic
Author

About HttpURLConnection's setDoInput

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 762
In EPractice lab, there is a question like this:

//Only important words are shown:
Select one:
A. Both doInput and doOutput flags must be true to interact with web service provider. To achieve this, we must call setDoInput(true) and setDoOutput(true) method before obtaining connection.
B. Only doInput flag must be true....
C. Only doOutput flag must be true to interact with web service provider. To achieve this, we must call setDoOutput(true) method before obtaining connection.
D. Both doInput and doOutput flags must be false......

I believe C is the answer. By default, doInput flag is true. Even if we don't call setDoInput(true), this doInput flag is still true. And it won't harm if we call setDoInput(true). And it is not a must to call setDoInput(true). However, it is a must to call setDoOutput(true) because doOutput is false by default.

But the given answer is A.
 
GeeCON Prague 2014
 
subject: About HttpURLConnection's setDoInput