如何从默认包中将默认包中的java类导入 [英] How import java classes inside the default package from the default package

查看:159
本文介绍了如何从默认包中将默认包中的java类导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想能够使用import或至少克服编译问题在某种程度上我目前已经给了我的默认包中的2个文件(hmk要求)和一个类别另一个有一个类以及一个主要的。现在,与主要的文件似乎并不知道其他文件至少远远超过了eclipse。 import [otherfilenameWithout.java] 似乎不起作用。



我确实看到了,但似乎这些关于从非默认包访问到默认包的答案。我可能会错了。



如何在默认包中访问java类?

解决方案

默认情况下同一包中的类已经导入。您不需要为此声明任何导入。
所以要访问默认包类只能通过默认包中的类来完成。


I want to be able to use import or at least overcome the compilation problem in some way I am currently having given that I have a 2 files in the default package (hmk requirement) and one has a class the other has a class as well as a main. Right now the file with the main seems unaware of the other file at least as far as eclipse is concerned. import [otherfilenameWithout.java] doesn't seem to work.

I did see this but it seem like these answers are in regard to accessing from a non-default package to the default package. I could be wrong though.

How to access java-classes in the default-package?

解决方案

By default, the classes in the same package are already imported. You don't need to declare any import for this. So to access to the default package classes can only be done by classes in the default package.

这篇关于如何从默认包中将默认包中的java类导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆