This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Short Pop Quiz Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Short Pop Quiz" Watch "Short Pop Quiz" New topic
Author

Short Pop Quiz

Mike Cunningham
Ranch Hand

Joined: Nov 14, 2000
Posts: 129
The file in the example below was 5 bytes long. What is the length of the file after the following code gets executed?

The answer is supposed to be 6 but I don't see how it computes this answer?
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
First the content of the file is overwritten and not appended.
Then, "BYE" is composed of three characters and a character is 2-bytes long => 3*2 = 6 bytes !
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Mike Cunningham
Ranch Hand

Joined: Nov 14, 2000
Posts: 129
Thanks for the info. You're GOOD!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Short Pop Quiz
 
Similar Threads
NX:About MAGIC flag in the Data file
A questin in Marcus's tutorial
io
JQ+ question RandomAccessFile help.....
how to getcursor to first location of file?