• 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

write(0x01234567)

 
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If write(0x01234567) is called on an instance of output stream,
what will be written to the destination of the stream?
a. The bytes 0x01, 0x23, 0x34 in that order
b. The byte 0x01
c. The byte 0x67
d. None of the above
When i write(0x01234567) i dont see anything in the file
ie (d) but the ans is c? why?
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The correct answer is 'c'.
When you use write method on an output stream, it always writes the low order byte if the integer, in this case 0x67.
Hope this helps,
------------------
Asma Zafar,
Sun Certified Programmer for Java2 Platform
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the reason you not see the output is (maybe) not have fulsh() after the write() method
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic