Declaring static string array

So i'v been trying to create a very simple array of strings like so :

String[] painfull_lang = [ "word1","word2","word3"];

but i keep getting syntax errors

Cannot cast from [java.util.ArrayList] to [java.lang.String[]].

  "String[] painfull_lang = [ \"word1\",\"word2\",\"word3\" ...",
  "      ```

i also tried :

List test = Arrays.asList("");
List test = new ArrayList<>(Arrays.asList(""));

Hi @dat_boi

Did you try this:

  String[] painfull_lang = new String[] {"word1","word2","word3"};
1 Like

thank you @RabBit_BR it worked !

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.