读书人

java 引入自定义包的有关问题

发布时间: 2012-01-22 22:38:43 作者: rapoo

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类放在同一个包??
[解决办法]
小问题~

读书人网 >J2SE开发

热点推荐