When defining a setter how would i code the value of the setter to be dependent on user input vs a static value? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

When defining a setter how would i code the value of the setter to be dependent on user input vs a static value?

Getters and setters

2nd Mar 2019, 6:26 AM
Nick Nelson
Nick Nelson - avatar
2 ответов
+ 2
You could do something like this: https://code.sololearn.com/cu7gsxBIvaYu/#java the setter still has a variable as argument, but when you call it, the value passed can come from a scanner.
2nd Mar 2019, 9:39 AM
Tibor Santa
Tibor Santa - avatar
0
Thanks Tibor
21st Mar 2019, 3:44 PM
Nick Nelson
Nick Nelson - avatar