Hi, the following is cut and paste from book A Programmer's Guide to Java CERTIFICATION by <code>Khalid A. Mughal and Rolf W.Rasmussen, p.662(18 Files and Streams)</code> <code> The seperator constant is of type String and contains the sequence of characters used as path separators on the native platform. The most common platforms only use a single character as a path separator, but there is no such restriction. </code> Hope it helps. Guoqiao
Originally posted by jordan gong: Dear Helper: How many characters can the seperator in File class contain? One or multiple? Thanks
Guoqiao Sun<br />SCJP2 SCWCD2<br />Creator of <a href="http://www.jiris.com/" target="_blank" rel="nofollow">www.jiris.com</a>, Java resource, mock exam, forum
posted 19 years ago
Guoqiao: Thanks a lot. You really helped me a lot! Pay attention to JQPlus, there are many answers wrong in the exam. For example, this one. The answer they give is for only one character. Thanks.
The given answer in JQPlus is correct. The statement given in the book mentioned is wrong. The field separator of File class is just a string representation of separatorChar. separatorChar is a char and obviously can have only 1 char. There is another field named pathSeparator of class String. This also can contain only one char because it represents pathSeparatorChar (which, again, if of type char) in a string. Please read the API for File class for more details. Please let us know if you find "wrong" answers. HTH, Paul.