String...(String后面三个点)的含义

xiaoxiao2025-02-11  8

场景:

List findByExample(T exampleInstance, String... excludeProperty);

JDK5新特性之一

String... excludeProperty表示不定参数,也就是调用这个方法的时候这里可以传入多个String对象

使用实例:

public class Main { public static void main(String[] args) { //测试,传入多个参数 test("hello", "world", "13sd", "china", "cum", "ict"); } public static void test(String... arguments) { for (int i = 0; i < arguments.length; i++) { System.out.println(arguments[i]); } } }

转载请注明原文地址: https://www.6miu.com/read-5024477.html

最新回复(0)