日期:2014-05-20  浏览次数:20554 次

java 引入自定义包的问题
package one;

public class a 
{
}
-----------------------------------
import one.a;

class b 
{
a aa = new a();
}
这样程序编译通过
-----------------------------------
可是改成

import one.*;

class b 
{
a aa = new a();
}

就提示
file does not contain class a
Please remove or make sure it appears in the correct subdirectory of the classpath.
  a aa = new a();
  ^
1 error

这是怎么回事啊?难道包里面的类不能用通配符?


------解决方案--------------------
不可能的,你用什么IDE工具啊。
------解决方案--------------------
额。。你的类在one下面,为什么还要用import one.*;?这表示你的类在one/....下面
------解决方案--------------------
嘿。。我用JCreator有时候也会出现这样的问题。。。
------解决方案--------------------


A,B类放在同一个包??
------解决方案--------------------
小问题~