Ankitha Reddy has Published 72 Articles

How to add items to an array in java dynamically?

Ankitha Reddy

Ankitha Reddy

Updated on 30-Jul-2019 22:30:20

9K+ Views

Since the size of an array is fixed you cannot add elements to it dynamically. But, if you still want to do it then, Convert the array to ArrayList object.Add the required element to the array list.Convert the Array list to array.Exampleimport java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class AddingItemsDynamically ... Read More

Why do Java array declarations use curly brackets?

Ankitha Reddy

Ankitha Reddy

Updated on 30-Jul-2019 22:30:20

483 Views

Curly brackets usually denote sets and ensembles while parenthesis usually in most Algol-based programming languages curly braces are used to declare arrays.

Previous 1 ... 4 5 6 7 8
Advertisements