我有两个类 Owning 和 OwningAccessor。这些文件位于同一目录中。
public class Owning {
String _name = "";
public void printBanner()
{
}
public void printOwning(double amount)
{
printBanner();
//print details
System.out.println("name:" + _name);
System.out.println("amount:" + amount);
}
}
public class OwningAccessor {
public void access()
{
Owning o = new Owning();
o.printOwning(500);
}
}
当我尝试用 编译OwningAccessor
时javac -cp . OwningAccessor.java
,出现编译错误。
symbol : class Owning
location: class smcho.OwningAccessor
Owning o = new Owning();
^
OwningAccessor.java:6: cannot find symbol
symbol : class Owning
location: class smcho.OwningAccessor
Owning o = new Owning();
^
这有什么问题?该代码在 Eclipse IDE 下编译良好。