Computer scienceBackendSpring BootWebREST

Response bodies

Theory

JSON string

Report a typo

You have the following class declaration and an instance of that class:

Java
// Class declaration
class Person {
    private String name;
    private int age;
    private String hidden;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
        this.hidden = "hidden"
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }
}

// Class instance
var person = new Person("John", 22);
Kotlin
// Class declaration
data class Person(
    val name: String,
    val age: Int,
    private val hidden: String = "hidden"
)

// Class instance
val person = Person("John", 22)

Which JSON string a client will get after Spring Boot serializes it using default settings?

Select one option from the list
___

Create a free account to access the full topic