Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Cannot find symbol: variable Objects

I generated methods hashCode() and equals(Object obj) by netbeans insercode. In netbeans I can compile without errors, but when I compile it on my server with javac:

bangserver/Login.java:3: cannot find symbol
symbol  : class Objects
location: package java.util
import java.util.Objects;
                ^

and other errors with Objects...

public int hashCode() {
    int hash = 5;
    hash = 47 * hash + Objects.hashCode(this.password);
    return hash;
}

What you guys think should be problem he can't find java.util.Objects ?

like image 210
SpeedEX505 Avatar asked Feb 17 '23 18:02

SpeedEX505


1 Answers

It looks like you're compiling with a Java verson older than Java 7, since java.util.Objects was only added in Java 7.

like image 94
Louis Wasserman Avatar answered Feb 28 '23 10:02

Louis Wasserman