I've got to use the method split()
as in the following code, but the compiler throws an error:
String defA1[] = new str1.split(" ");
The error thrown says:
error: package str1 does not exist
String defA2[] = new str1.split(" ");
^
Obviously it is not a package, str1
is a string previously defined that comes as an argument of a method, as following:
public static int calculateLevenshteinDistance(String str1, String str2) { ... }
I am also importing the package java.lang
import java.lang.*;
and even explicitly
import java.lang.String;
Please do not suggest StringTokenizer
, I want to know why this is not working.
Also you could help me with something else. I tried importing the package as static just wondering if that could fix it:
import static java.lang.*;
But the compiler would say:
error: cannot find symbol
import static java.lang.*;
^
It only happens when I add "static" to the import and it happens with any static import I dont know why.
I am using the JVM to compile.