Question: Make a class called User that stores a username and password. Implement the Comparable interface. Compare two users based on their password length. Shorter passwords

Make a class called User that stores a username and password. Implement the Comparable interface. Compare two users based on their password length. Shorter passwords come first.
If the passwords have the same length, then compare based on case-insensitive alphabetical order of the password. If the passwords match, compare based on the case-insensitive username.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!