Varshini Priya wrote:
In java Array is a type of object so when you declare
String [] a = new String[5];
you are declaring an object of type string array and not the type of string. In your code you are getting error because you are declaring same variable 'names' twice. If you want to assign the values for elements of an array then assess elemens one by one and assign values.
if you write String a [] = new String["a", "b"] then you are creating an array object of type string as well assigning the value of its element.