java完全限定名是什么
巴扎黑
巴扎黑 2017-04-18 10:45:52
0
2
1175
巴扎黑
巴扎黑

Antworte allen(2)
小葫芦

举一个栗子:

我的一个类里面引入了:
import org.apache.commons.lang3.StringUtils;

这个时候我的类用StringUtils类里面的方法就可以:

boolean isEmpty = StringUtils.isNotEmpty(str);

没错,就是可以直接用他里面的方法。

然后假设这时候我想在这个类里用spring提供的StringUtils里面的方法,但是我并没有import spring的StringUtils类进来,这时候怎么办呢? 我们可以这样(前提是有spring的jar):

boolean isEmpty = org.springframework.util.StringUtils.isEmpty(str);

没错 ,就是全限定名访问spring的StringUtils类。

这是我的理解,欢迎指正。

刘奇

这种问题查 JLS 就行了
6.7. Fully Qualified Names and Canonical Names

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!