I'm a bit tired of using loops to print an array,
Java has a function called toString
, it takes your array as an argument, and it returns a string that we can print.
It's time to learn how to update arrays.
String[] flavours = { "Sweet", "Sour", "Bitter" };
flavours[2] = "Salty";
NO.
Once you create an array, you cannot resize it.
String[] menu = { "Espresso", "Iced Coffee", "Latte" };
String[] newMenu = new String[5];
for (int i = 0; i < menu.length; i++) {
newMenu[i] = menu[i];
}