I am trying to copy the values of the variable s1 into the element of s2 and I am getting null. What am I doing wrong. Here are my Code:
public class Main {
public static void main(String[] args) {
String[] s1 = new String[10];
String[] s2 = new String[10];
String[] s3 = new String[10];
for (int i = 0; i < s1.length; i++){
s2[i] = s1[i];
System.out.println("s2[" + i + "] : " + s2[i]);
}
}
}
-------- output -------
s2[0] : null
s2[1] : null
s2[2] : null
s2[3] : null
s2[4] : null
s2[5] : null
s2[6] : null
s2[7] : null
s2[8] : null
s2[9] : null