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 Marcus Green #3 Question 33 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 "Marcus Green #3 Question 33" Watch "Marcus Green #3 Question 33" New topic

Marcus Green #3 Question 33

John Towell

Joined: Jul 26, 2002
Posts: 20
Question 33)
Which of the following statements are true?
1) Java uses a system called UTF for I/O to support international character sets
2) The RandomAccessFile is the most suitable class for supporting international character sets
3) An instance of FileInputStream may not be chained to an instance of FileOutputStream
4) File I/O activities requires use of Exception handling
Answer = 1,3,4
Answer 1 should be UTF-8 right? I don't know if there are different UTFs, but I didn't check it since it didn't say UTF-8.
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Read more about Unicode here

SCJP2. Please Indent your code using UBB Code
John Towell

Joined: Jul 26, 2002
Posts: 20
Coll thanks for the link. So the answer should be UTF-8 right?
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Not necessarily.
For internationalization you can use charsetsfor converting between Java characters or strings and the especified charset.
The following charsets must be supported:

US-ASCII Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set
ISO-8859-1 ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
UTF-8 Eight-bit UCS Transformation Format
UTF-16BE Sixteen-bit UCS Transformation Format, big-endian byte order
UTF-16LE Sixteen-bit UCS Transformation Format, little-endian byte order
UTF-16 Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark

You can pass them as parameters to the InputStreamReader and OutputStreamWriter constructors.
Also you can pass a charset to the
java.lang.String)" target="_blank" rel="nofollow">String.getBytes(String) method.
Not passing any charset to these methods will let the JVM to use the platform default.
subject: Marcus Green #3 Question 33
Similar Threads
UTF encoding
Marcus's tutorial on I/O
help on one question?