aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What is charS? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is charS?" Watch "What is charS?" New topic
Author

What is charS?

Tom Baker
Greenhorn

Joined: Oct 17, 2000
Posts: 6
On a mock exam I had a question dealing with "charS" does anyone have an idea what it is reference to. (the mock exam answer was vague, but said it had to do with inputstreamreader?)
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
The DataOutputStream has a method writeChars(String s) which will write the String s, writing one char at a time. Since this is part of the OutputStream class it writes it in bytes so you get two bytes per char and once the entire string is written the counter written is incremented by twice the length of the string.
Bill
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

bill.
perhaps you can help me. Why would I want to write a String using a DataOutputStream? I would think that I would always use a Writer of some sort, wrapped in a BufferedWriter and probably that wrapped in a PrintWriter.


SCJP
Visit my download page
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
Randall, I wouldn't use DataOutputStream. That is what Readers and Writers are for. But the functionality is provided in DataOutputStream.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is charS?