send information to another class

I’m learning java and I have a problem, I’m working on library system and can’t figure out how to send information about created user to list(hashMap) of users…

On the picture below is my code, in red circle admin call method to create librarian. Problem is I can’t figure out how to send information about this to blue circle to add this new librarian to list of users… I thought I would move hashMap activeUsers to class admin but i need librarians to create customers as well so…

any idea please?

2 Answers

You can either make the variables public, so you can access to them from all the other classes, or you could write methods that return their value that you can call from any other class. You can find more information here too, if you need.

You can try addUser(l.name, l.psw) in createLibrarian() function. Thanks

Archive from: https://stackoverflow.com/questions/59064248/send-information-to-another-class

Share

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *