Text field parameters

Report a typo

Let's say you have an instance of a data class with some settings: fontFamily, text, and textSize. Use apply and also to change the value of text based on data from standard input and print the updated instance of the class.

Sample Input 1:

Button

Sample Output 1:

Old settings: TextField(text=Hello!, textSize=12, fontFamily=Roboto)
New settings: TextField(text=Button, textSize=12, fontFamily=Roboto)
Write a program in Kotlin
data class TextField(
var text: String = "Hello!",
var textSize: Int = 12,
var fontFamily: String = "Roboto"
)

fun main() {
val textField = TextField()

textField // Write your code here
}
___

Create a free account to access the full topic