foo
|-test
|-xcom
|-A.class
|-B.java
And two files:
package xcom;
public class A{}
package xcom
public class B extends A{}
Given above directory structure where root dir is foo. Class B extends A.
Question is:
Which allows B.java to compile?
The answer is: Set the current dir to test then invoke javac -cp . xcom/B.java
My doubt is why the option below won't work?
1. Set the current dir to xcom then invoke javac -cp . B.java
? Isn't this looking for A.class in xcom because of the (.) ?
2. By setting test as current dir, and using (.) isn't it searching for A.class only in test dir and not xcom?
3. Also it says in solution, because A.class is in xcom package, it will not find A.class if invoked from xcom dir. Why is that? Won't the (.) make it work?