There are many ways to do it. It depends on the data type.
int[] myIntArray = new int[3];
int[] myIntArray = {1,2,3};
int[] myIntArray = new int[]{1,2,3};
It's the most basic form, and the string class is the same.
String[] myStringArray = new String[3];
String[] myStringArray = {"a","b","c"};
String[] myStringArray = new String[]{"a","b","c"};
You can do it like this.
© 2024 OneMinuteCode. All rights reserved.