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

reply all(2)
小葫芦

Give me an example:

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

At this time, my class can use the methods in the StringUtils class:

boolean isEmpty = StringUtils.isNotEmpty(str);

That’s right, you can directly use the method in it.

Then suppose that I want to use the methods in StringUtils provided by spring in this class, but I do not import spring's StringUtils class. What should I do at this time? We can do this (provided there is a spring jar):

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

That’s right, it’s the fully qualified name to access spring’s StringUtils class.

This is my understanding, any corrections are welcome.

刘奇

Just check JLS for this kind of problem
6.7. Fully Qualified Names and Canonical Names

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!