• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

About HttpURLConnection's setDoInput

 
Bartender
Posts: 2419
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic