84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
举一个栗子:
我的一个类里面引入了:
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
举一个栗子:
这个时候我的类用StringUtils类里面的方法就可以:
没错,就是可以直接用他里面的方法。
然后假设这时候我想在这个类里用spring提供的StringUtils里面的方法,但是我并没有import spring的StringUtils类进来,这时候怎么办呢? 我们可以这样(前提是有spring的jar):
没错 ,就是全限定名访问spring的StringUtils类。
这是我的理解,欢迎指正。
这种问题查 JLS 就行了
6.7. Fully Qualified Names and Canonical Names