我正在尝试使用一个 println 设置多个字符串变量。这是我所拥有的:
Scanner scanner = new Scanner(System.in);
String teacher = "";
String classSelect = "";
String location = "";
System.out.println("Enter a teacher: ");
teacher = scanner.next();
System.out.println("Enter a class name: ");
classSelect = scanner.next();
System.out.println("Enter a location: ");
location = scanner.next();
这是我想要完成的事情:
String section = "";
String instructor = "";
String location = "";
System.out.printf("Only fill in applicable criteria, leave the rest blank :\n"
+ "Section://Sets section var// \n"
+ "Instructor://Sets instructor var// \n"
+ "Location://Sets location var// \n");