Closing delimiter

Report a typo

Take the following code:

String nameAnimal = "Pencil";
String typeAnimal = "Cat";

String firstAnimal = """
    name: %s
    type: %s
    """.formatted(nameAnimal, typeAnimal); 

String secondAnimal = String.format("name: %s\ntype: %s", nameAnimal, typeAnimal);

In this piece of code:

boolean result = firstAnimal.equals(secondAnimal);

The result is ...

Enter a short text
___

Create a free account to access the full topic