Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsFillExample2 { public static void main(String[] args) { //Create a list object List
arrList = Arrays.asList(1,2,3,4); //Fill the list with 551 Collections.fill(arrList,551); //Print the List for(Integer i :arrList) { System.out.print(i +" "); } } }
Output