static 静态导包

时间:2023-03-08 15:38:03

静态导入 ArrayUtils 类的 INDEX_NOT_FOUND 属性和 add 方法

import static org.apache.commons.lang3.ArrayUtils.INDEX_NOT_FOUND;
import static org.apache.commons.lang3.ArrayUtils.add;
import org.junit.Test; /**
* @作者 王睿
* @时间 2016-5-18 下午4:00:08
*
*/
public class StaticTest { @Test
public void testStatic(){
System.out.println(INDEX_NOT_FOUND);
int[] arr = new int[]{1,2,3,4,5,6};
arr = add(arr, 7);
for (int i : arr) {
System.out.println(i);
}
/**
* 输出:
* -1
* 1
* 2
* 3
* 4
* 5
* 6
* 7
*/
} }