I have a question in SCJP text book by Kathy Sierra and Bert Bates in Development chapter.

Q. Given the default classpath: /foo

And the directory structure:

  foo
      |
      test
         |
         xcom
             |--A.class
             |--B.java

And these two files as mentioned in the code snippet section.

Amongst the choice,
1. javac -classpath . xcom/B.java

2.javac -classpath xcom:. B.java

Correct answer is option 1. But my doubt is that isn't option 2 going to perform same operation? If not, what is the difference between the two syntax?

h . x

I think you (or they) have forgotten to mention the Current Working Directory is 'test'.
So in that case 'javac' would not be able to find B.java in test and give you an error.