Couple of things, as people have said regular arrays in Java must be declared with a "new" statement as well as a size. You can have an empty array if you want, but it will be of size 0.
Now, if you want a dynamic array you can use an ArrayList. Its syntax is as follows:
ArrayList<Primitive_Type_Here> = new ArrayList<Primitive_Data_Type_Here>();
Now, once again if you do not tell the array what to have then there is no point in even doing anything with either array type. For ArrayLists you would have to tell it to add any object that fits its type. So for example I can add "Hello World" into an ArrayList we can do the following code.
ArrayList<String> sList = new ArrayList<String>();
sList.add("Hello World");
System.out.println("At index 0 our text is: " + sList.get(0));
//or if you want to use a loop to grab an item
for(int i = 0, size = sList.size(); i < size; i ++)
{
System.out.println("At index " + i + " our text is: " + sList.get(i));
}
**If you are wondering why I am using .size() instead of .length is because arrayLists do not have a .length method, and .size does the same thing for it.
**if you are wondering why I have int = 0, size = sList.size(); it is because this way you enhance your code performance as your loop is of O(n) complexity, however if we were to do i < sList.size() it would be O(n) * sList.size() as you would constantly be calling sList.size() per iteration of your loop.