首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

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

2012-01-22 
java 引入自定义包的问题package onepublic class a{}-----------------------------------import one.a

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

热点排行