I have a String array like below:
String[] titles = new String[] { "Booking", "Entry", "Type",
"Duration", "Status", "Contract ID",
"Capacity", "Start Day", "End Day", "Source Ref" };
I need to append, some more values to this array at later state, like below:
titles = new String[] { "Booking", "Shipper", "Booking Quantity", "Entry",
"Type", "Duration", "Status",
"Contract ID", "Capacity", "Start Day",
"End Day", "Source Ref" };
here I added "Shipper", "Booking Quantity" to the first array.
Is there any way to append those values based on index or any way, without creating like above example? (Is it possible?)
when you initialize an array like this
Property of array “once you initialize the array after that you can’t change the size of array”*
so in your case you must initialize new array ….
Or you can use
ArrayListand with itsadd(index, value)method you can add your value at your requiredposition ..
But implicit it also use
Concept of Dynamic Array..