1//original array
2String[] rgb = new String[] {"red", "green"};
3//new array with one more length
4String[] rgb2 = new String[rgb.length + 1];
5//copy the old in the new array
6System.arraycopy(rgb, 0, rgb2, 0, rgb.length);
7//add element to new array
8rgb2[rgb.length] = "blue";
9//optional: set old array to new array
10rgb = rgb2;
1-- how to add objects using an array
2car redCar = new Car("Red");
3car Garage [] = new Car [100];
4Garage[0] = redCar;