Wrong output when printing out from an array (JAVA)
Go to solution
Solved by Ominous,
Remove the static from:
private static String recipient;
Static means that recipient has the same value for all instances of the class. You're overwriting the variable every time you called the constructor which is why it's always the name of the last person in the cards array.

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now