recently registered on Code Wars and im doing the first exercise where you have to sort words by numbers which are in the words of the sentence.
public class Application {
public static void main(String[] args) {
String word = "is2 Thi1s T4est 3a";
System.out.println(order(word));
}
public static String order(String words) {
String end = "";
String[] words2 = words.split(" ");
ArrayList<String> wordss = new ArrayList<String>(Arrays.asList(words2));
for (int i = 1; i <= wordss.size(); i++) {
String number = Integer.toString(i);
for (String words1 : wordss) {
if (words1.contains(number)) {
end += words1 + " ";
}
}
}
return end;
}
}
I did the exercise on NetBeans and it works perfectly fine but when i paste this code into the CodeWars compiler it gives me this error:
./src/main/java/Order.java:10: error: cannot find symbol
List<String> wordss = new ArrayList<String>(Arrays.asList(words2));
^
symbol: class List
location: class Order
./src/main/java/Order.java:10: error: cannot find symbol
List<String> wordss = new ArrayList<String>(Arrays.asList(words2));
^
symbol: class ArrayList
location: class Order
./src/main/java/Order.java:10: error: cannot find symbol
List<String> wordss = new ArrayList<String>(Arrays.asList(words2));
^
symbol: variable Arrays
location: class Order
3 errors
what could be the reason?