Challenge: Exception Handling
Try to implement a class using proper exception messages for invalid input.
We'll cover the following...
Task
You are given a User
class with the methods that set and get the user name and age.
- Add code to the
setName()
method that throws the exception“The name should be at least 3 characters long”
whenever the user’s name is shorter than 3 letters.