Simple array question

G

Gianni

// i define the array in this way
String [] cars;
if (idcriterio30.equals("") && periodoSelezionato <1440)
{
// and try to fill it this way
cars[] = criterio2.split(",");
}
else if (periodoSelezionato <= 1440 & criterio30.equals("T"))
{
cars[] = idcriterio30.split(",");
}
else if (periodoSelezionato > 1440 &&criterio31.equals(""))
{
cars[] = criterio2.split(",");
}
else if (periodoSelezionato > 1440 && criterio31.equals("T"))
{
cars[] = idcriterio31.split(",");
}

Why I have an error ??
thanks
 
A

Antti S. Brax

// i define the array in this way
String [] cars;
if (idcriterio30.equals("") && periodoSelezionato <1440)
{
// and try to fill it this way
cars[] = criterio2.split(",");
Why I have an error ??

You have a syntax error. When referring to a variable, be it
a primitive type, array or another object, you use the variable
name only:

cars = criterio2.split(",");

For further reference, when posting a question asking why you
get an error it is very helpful if you include the error message
to the question.

Also read: http://www.physci.org/codes/sscce.jsp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top