Getting token unexpected error when declaring String array

I am trying to declare string array but I am getting unexpected token error. not sure what wrong I am doing.
String[] dataValues
dataValues = new String[]{‘Url’, ‘Username’, ‘Password’}

Description Resource Path Location Type
unexpected token: Url @ line 22, column 27. Script1591064744798.groovy //Scripts/testData/testData_readexcel line 22 Groovy type checking problem

But when I try to look at the examples everywhere I saw the same declaration.

String[] dataValues = ["one", "two", "three"]

I’ll let @Brandon_Hein cover the other possibilities.

Thanks it works. I am not sure why its different when declaring in katalon is different from java.

In test case scripts of Katalon Studio, you are supposed to speak in Groovy, not in Java.

Just for your interest, I will add an explanatory Groovy code here

List<String> list = ["Url", "Username", "Password"]
String[] dataValues = list as String[]
1 Like