The role of Java in ...

Role in Java ..., representing a plurality of receiving the same type of parameter

public void testFunction (int ... arr) {// int receiving a plurality of types of parameters
    for (int i:arr) {
        System.out.println(i+" ");
    }
}
 
 
@Test
public void findByCategoryTypeIn() {
    testFunction(1,2,3,4,6,7);
}
 
result:
1
2
3
4
6
7

Guess you like

Origin www.cnblogs.com/yyywh/p/11308286.html