Reputation: 22044
and a little confused about the compile process:
There's my file structure
bin/ test/A.java test/B.java
# B.java
package test;
private class B{
public static void say(){
System.out.println("Hello.");
};
}
# A.java
package test;
public class A{
public static void main(String arg[]){
test.B.say();
}
}
then I compile A.java
javac -cp test/*.java test/A.java
It gives me error:
test/A.java:4: cannot find symbol
symbol : class B
location: package test
test.B.say();
^
1 error
Upvotes: 0
Views: 88
Reputation: 25695
B
should be a public class not a private class. Changing from private class B
to public class B
works out and compiles successfully.
Upvotes: 2