Good day!
I am reading a Java book about encapsulation and it mentioned the getter and setter method.
I\'ve read that to hide the attributes, I must mark my
I find the answers above already answering your question. But, I see another issue with your code, which is, a security and data integrity issue. You are filling your class member directly out of the user's input w/o any validations on it. For example, you'd probably want to check that the email address has an xyz@abc.com pattern. A malicious user might also provide a very long string in the input causing unexpected errors.