Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Declaring an array of int in xtend

Tags:

arrays

int

xtend

How can I declare an array of int in xtend?

I've tried ArrayList but I get the error "The primitive 'int' cannot be a type argument".

like image 829
chris yo Avatar asked Jul 26 '13 05:07

chris yo


People also ask

How do you declare an array declaration?

The syntax for declaring an array is: datatype[] arrayName; datatype : The type of Objects that will be stored in the array eg. int , char etc.

How do you declare an int array in Java with values?

We declare an array in Java as we do other variables, by providing a type and name: int[] myArray; To initialize or instantiate an array as we declare it, meaning we assign values as when we create the array, we can use the following shorthand syntax: int[] myArray = {13, 14, 15};

How do you create an array of int and String?

You can convert a String to integer using the parseInt() method of the Integer class. To convert a string array to an integer array, convert each element of it to integer and populate the integer array with them.

How do you declare an array and initialize it with 5 numbers in Java?

int a [] = new int[5]; [D]. Explanation: Option B is the legal way to declare and initialize an array with five elements.


1 Answers

Please refer to the docs for details, but essentially its something along these lines:

val int[] x = newIntArrayOfSize(5)

or if you want to define an array literal:

val int[] x = #[1, 2, 3]
like image 150
Sebastian Zarnekow Avatar answered Nov 15 '22 09:11

Sebastian Zarnekow