Difference between Arrays and 3 dots (Varargs) in java

The three dots can only be used in a method argument, and are called ‘varargs’. It means you can pass in an array of parameters without explicitly creating the array.

private void method(String[] args) {} is called like method(new String[]{"first", "second"});

private void method(String... args) {} is called like method("first", "second");

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)