Question: I am attempting to get multiple String variables set with one println. Here is what I have:

```
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();

```

Here is what I would like to accomplish:

```
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");

```

Answer: 
This might not be an ethical way but try it

```
System.out.printf("Only fill in applicable criteria, leave the rest blank and use | after every field:\n"
        + "Section://Sets section var// \n"
        + "Instructor://Sets instructor var// \n"
        + "Location://Sets location var// \n");

```

if the user enteres

```
abc|xyz|loc

```

accept it in a string

```
String input = scanner.nextLine();
String[] inputs=input.split("|");
inputs[0]//<--section
inputs[1]//<--instructor
inputs[2]//<--location

```
Are you looking for this:

```
   String message = 
        String.format("Only fill in applicable criteria, leave the rest blank :\n"
        + "Section: %s \n"
        + "Instructor: %s \n"
        + "Location:%s \n", 
        section ,instructor,location );

```

or this?

```
    System.out.printf("Only fill in applicable criteria, leave the rest blank :\n"
            + "Section: %s \n"
            + "Instructor: %s \n"
            + "Location:%s \n", 
            section ,instructor,location );

```