定义String 数组其中某个元素可以存放空格么?控制台输入一个元素0 2,2就默认给了Vchar1[1]了
public class test {
public static void main(String[] args) {
String vchar1[]=new String[5];
Scanner vcharSysin =new Scanner(System.in);
for(int i=0;i<vchar1.length;i++){
System.out.print("请输入vchar1数组一个元素vchar1["+i+"]的值:");
vchar1[i]=vcharSysin.next();
}
System.out.println("输出数组vchar1"+vchar1[0]+" "+vchar1[1]+" "+vchar1[2]+" "+vchar1[3]+" "+vchar1[4]+"");
}
}