A
au714
I think I should be able to compile the following 2 files. Class
A.java specifies interface A. Class B.java in package impl implements
interface A.
A.java is in the current directory (.). B.java is in the directory
impl.
public interface A {
public void a();
}
package impl;
public class B implements A {
public void a() {
System.out.println("B.a()\n");
}
public static void main(String[] args) {
B b = new B();
b.a();
}
}
I run javac from the current directory (.) as follows, and get the
following error:
$> javac A.java impl/B.java
impl/B.java:3: cannot resolve symbol
symbol : class A
location: class impl.B
public class B implements A {
^
1 error
I also tried as:
javac -sourcepath . A.java impl/B.java
This is so simple, what am I missing?
FGB
A.java specifies interface A. Class B.java in package impl implements
interface A.
A.java is in the current directory (.). B.java is in the directory
impl.
public interface A {
public void a();
}
package impl;
public class B implements A {
public void a() {
System.out.println("B.a()\n");
}
public static void main(String[] args) {
B b = new B();
b.a();
}
}
I run javac from the current directory (.) as follows, and get the
following error:
$> javac A.java impl/B.java
impl/B.java:3: cannot resolve symbol
symbol : class A
location: class impl.B
public class B implements A {
^
1 error
I also tried as:
javac -sourcepath . A.java impl/B.java
This is so simple, what am I missing?
FGB