import java.util.Scanner; public class Test { private static String num; private static String cla; private static String name; public static void main(String[] args) { m1(); System.out.println("姓名"+name+"\n"+"学号"+num+"\n"+"班级"+cla+"\n"); } public static void m1(){ Scanner s= new Scanner(System.in); System.out.println("请输入名字:"); name = s.nextLine(); System.out.println("请输入学号:"); num=s.nextLine(); System.out.println("请输入班级:"); cla=s.nextLine(); } }
时间: 2024-10-14 18:50:00