#Simple Array related question (giving an method that requires an Array and array )
16 messages · Page 1 of 1 (latest)
<@&987246487241105418> please have a look, thanks.
{components} that is invalid syntax
i mean just like in an example like that this would work
you need to do new Component[] {component}
hmm, i mean i think in the past i did something like that in the past, (that time must have been with numbers, wich should not really change anything)
ohhhhh
now i get it

thanks 😭
yeaaah that looks more like it
int[] a = {1,2,3,4} is just syntactical sugar for int[] a = new int[] {1,2,3,4}
an array in java is always an heap object. but you also can not create arrays with {}
that is special syntax for defining on the right hand side of an declaration with definition
just a free {1,2,3,4} does not create an object it is invalid syntax
so you can only use= {...} when you declare the array
ye its almost self answering, you gotta tell the method first you want to give it an array as i would understand, still learning, i mean that project is something new again, to learn more, firstly to learn about http requests with java, and always writing something new, to write better and simpler code