I am trying to import the package java.util.function but I keep getting the following error:
FP.java:2: error: cannot find symbol
import java.util.function;
^
symbol: class function
location: package java.util
I have verified that I am using jdk 1.8.0_11 (using javac -version).
That isn't how you import a package, this
import java.util.function;
should be
import java.util.function.*;
To import the classes in the java.util.function
package.
try
import java.util.function.Function;
Function
is a class under java.util.function
package.
for importing all classes in package you have to use *
like
import x.y.*;
for importing only one class you should use class name like
import x.y.z;
for your case as function is a package so you should use
import java.util.function.*;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With