如何在字符串数组中存储字符串值?

0 java string

我想存储名称值 String a[] = new String[3];

public static void main(String[] args) throws IOException {
        BufferedReader bo = new BufferedReader(new InputStreamReader(System.in));
        String name = bo.readLine();
        String a[] = new String[3];
    }
}
Run Code Online (Sandbox Code Playgroud)

bur*_*bit 5

我想这应该足够了:

String a[] = new String[3];

for(int i=0; i<a.length;i++) {
    String name = bo.readLine();
    a[i] = name;
}
Run Code Online (Sandbox Code Playgroud)