Friday 21 October 2016

What is an array

What is an array

  • An array is a group of values where each value is recognized by an index

  • Array index starts with zero.
  • All the values should be same type.
  • Suppose, you created an int array then you should take only int values, if you take other values in int array then you will get compile time error.
Advantage of an array:
  1. Access the elements randomly.
  2. Code will reduce if we are declaring same multiple data types.
Limitations of an array:
  1. Size is fixed, size will not increase dynamically.
  2. To solve this limitations we need to choose collection framework.
Thanks for your time.
Nireekshan