+ 1
How to take input as name of a person and use it in a class?
How can we take name as a input form the user and use it in a class such as NameOfThePerson.Age
1 ответ
0
The class Scanner is the easiest way to take inputs directly from the user and just place the value provided into a variable that you can use as a parameter or however you like, just consider the implementation in your class design, cause "NameOfThePerson" looks like an instantiated reference variable (an Object of a class) calling the method or class variable "Age" instead of a variable capable of receiving a value directly.