不会这种问题,想要一个编程答案

img

public static void main(String[] args) {
        String[][] arr= {
                {"龙","门","横","断","野"},
                {"驿","树","出","城","来"},
                {"气","色","皇","居","近"},
                {"金","银","佛","寺","开"},
                {"往","还","时","屡","改"},
                {"川","水","日","悠","哉"},
                {"相","阅","征","途","上"},
                {"生","涯","尽","几","回"}
        } ;
        for(int i = 0;i<8;i++){
            for(int j = 0;j<5;j++)
                System.out.print(arr[j][i]);
            System.out.println();
        }
    }


String[][] peotryLongmen={{
                            {"龙"},{"门"},{"横,{""},{""},{""},{"驿"},{""},{""},{""},{""},{""}
                          },
                          {
                            {""},{""},{"皇,{"居"},{"近"},{","},{"金"},{"银"},{"佛"},{"寺"},{"开"},{"。"}
                          },
                          {
                            {"往"},{"还"},{"时,{""},{""},{""},{""},{""},{""},{""},{""},{""}
                          },
                          {
                            {""},{""},{"征,{"途"},{"上"},{","},{"生"},{"涯"},{"尽"},{"几"},{"回"},{"。"}
                          }}
//行输出
for(int i=0;i<peotryLongmen.length;i++){
    for(int j=0;j<peotryLongmen[0].length;j++){
        System.out.print(peotryLongmen[i][j]);
    }
    System.out.println();
}
//列输出
for(int i=0;i<peotryLongmen.length;i++){
    for(int j=0;j<peotryLongmen[0].length;j++){
        System.out.print(peotryLongmen[j][i]);
    }
    System.out.println();
}