(数组)感觉写的复杂了,有简化的吗
											 程序代码:
程序代码:import java.util.Scanner;
class Shuzu 
{
    public static void main(String[] args) 
    {
        String name[]=new String[4];
        //写入字符串
        for(int i=0;i<4;i++){
        if(i==0)
        System.out.print(i+1+".输入你的名字:");
        if(i==1)
        System.out.print(i+1+".输入你的年龄:");
        if(i==2)
        System.out.print(i+1+".输入你所在的班级:");
        if(i==3)
        System.out.print(i+1+".输入你职位:");
        Scanner scann=new Scanner(System.in);
        name[i]=scann.next();
        }
        System.out.println();//换行
             //输出已写入的字符串
        for(int j=0;j<name.length;j++){
        if(j==0)
        System.out.print(j+1+".你的名字:");
        if(j==1)
        System.out.print(j+1+".你的年龄:");
        if(j==2)
        System.out.print(j+1+".你所在的班级:");
        if(j==3)
        System.out.print(j+1+".你的职位:");
        System.out.println(name[j]);
        }
    }
}
										
					
	


 
											





 
	    

 
	

