• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

seperator in File class?

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Helper:
How many characters can the seperator in File class contain?
One or multiple?
Thanks
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


 
jordan gong
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Enthuware Software Support
Posts: 4466
42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

------------------
SCJP2 Resources, Free Question A Day, Mock Exam Results and More!
www.jdiscuss.com
Get Certified, Guaranteed!
www.enthuware.com/jqplus

Your guide to SCJD exam!
www.enthuware.com/jdevplus
 
You don't like waffles? Well, do you like this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic