fork download
  1. public class User {
  2. private String username;
  3. private String email;
  4.  
  5. @Override
  6. public int hashCode() {
  7. return Objects.hash(email, username);
  8. }
  9. @Override
  10. public boolean equals(Object obj) {
  11. if (this == obj) {
  12. return true;
  13. }
  14. if (obj == null) {
  15. return false;
  16. }
  17. if (!(obj instanceof User)) {
  18. return false;
  19. }
  20.  
  21. User other = (User) obj;
  22. return Objects.equals(password, other.password) && Objects.equals(username, other.username);
  23. }
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class User is public, should be declared in a file named User.java
public class User {
       ^
Main.java:7: error: cannot find symbol
		return Objects.hash(email, username);
		       ^
  symbol:   variable Objects
  location: class User
Main.java:22: error: cannot find symbol
		return Objects.equals(password, other.password) && Objects.equals(username, other.username);
		                      ^
  symbol:   variable password
  location: class User
Main.java:22: error: cannot find symbol
		return Objects.equals(password, other.password) && Objects.equals(username, other.username);
		                                     ^
  symbol:   variable password
  location: variable other of type User
Main.java:22: error: cannot find symbol
		return Objects.equals(password, other.password) && Objects.equals(username, other.username);
		       ^
  symbol:   variable Objects
  location: class User
Main.java:22: error: cannot find symbol
		return Objects.equals(password, other.password) && Objects.equals(username, other.username);
		                                                   ^
  symbol:   variable Objects
  location: class User
6 errors
stdout
Standard output is empty