This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi Astha , always remeber when a class is defined in a package then its name is changed to "packagename.classname". To compile B compiler should able to trace A i.e the classpath should contain the route to get to A so coming back to your options question
1 option is incorrect because if you set the current directory as "xcom" then javac will not able to find A because it is looking for xcom.A not A in the current directory
2 option is incorrect because "javac B.java" and "javac -classpath . B.java" have the same meaning i.e if you don't include classpath option during compilation then by default the classpath will be "." (current directory)
3 option is correct because as default directory is now "test" and it contains subdirectory "xcom" hence compiler will not face any problem searching for xcom.A