answersLogoWhite

0


Best Answer

No, it can be array, structure or union as well.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

No, of any data type, including arrays, structures, etc...

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Yes array can contain elements of an object And as well as primitive data type......

This answer is:
User Avatar

User Avatar

Anonymous

Lvl 1
4y ago

True

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Should element in an array must be of primitive data type?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why arrays are not primitive data type?

An array is a primitive data type. It is the element type that may or may not be primitive.


Can you store non primitive data type in the array list?

Yes you can store non primitive data type variables in an array. String is a non primitive data type. You can declare a string array as: String a[]=new String[10];


Is string arr a non primitive data type?

Depends on the context of the question you were asking from, there are 2 distinct answers: Yes and NO. In the narrowest definition, any array is NOT a primitive data type in C#. Hence a string array is NOT a primitive data type in that context. A string itself, however, is a primitive data type. Some developers would like to extend the definition of "primitives" into the arrays, collections, and Enumeration. Thus, in this context, an array of string IS a primitive data type.


When an array contains values other than primitive data types is it considered a control array?

Only if the non-primitive data types are actually controls, such as an array of label controls, or an array of edit boxes. However, a control array is still an array. The only difference is that the values will likely be resource handles (objects that refer or point to the actual object which will be stored elsewhere in memory) rather than an actual value itself. That is, an array of primitive data types stores the actual value in the array itself.


How can you create array of an object in java?

Array's can hold only primitive data types. if you want a collection of objects you must use an ArrayList or a Vector.

Related questions

Why arrays are not primitive data type?

An array is a primitive data type. It is the element type that may or may not be primitive.


Can you store non primitive data type in the array list?

Yes you can store non primitive data type variables in an array. String is a non primitive data type. You can declare a string array as: String a[]=new String[10];


Non primitive data type?

Struct or array.


Is array a primitive data structure?

No, it's not. But it can be based on primitive data types (int, char, long, double and so on).


Is string arr a non primitive data type?

Depends on the context of the question you were asking from, there are 2 distinct answers: Yes and NO. In the narrowest definition, any array is NOT a primitive data type in C#. Hence a string array is NOT a primitive data type in that context. A string itself, however, is a primitive data type. Some developers would like to extend the definition of "primitives" into the arrays, collections, and Enumeration. Thus, in this context, an array of string IS a primitive data type.


What is an array in java perspective?

In java,an array is a wrapper class.An array is an object and it gets room in heap.Array can store a collection of data's of same datatype.It can be used to store integers,strings even objects..its collections of data's.Wheather the array stores primitive data,s or objects in it an array s always an object. int numbers[] = new int[10]; this array is of size 10 which can hold 10 int values.This array numbers stores primitive data type but the array number is an object Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the above illustration, numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8.


When an array contains values other than primitive data types is it considered a control array?

Only if the non-primitive data types are actually controls, such as an array of label controls, or an array of edit boxes. However, a control array is still an array. The only difference is that the values will likely be resource handles (objects that refer or point to the actual object which will be stored elsewhere in memory) rather than an actual value itself. That is, an array of primitive data types stores the actual value in the array itself.


Why array is a primitive data structure?

An array is a primitive data structure because all elements are stored in contiguous memory. Unlike complex structures like lists and trees, elements are not stored in nodes that provide structural information. Structure is created from the elements themselves, insofar as each element is exactly the same length (in bytes) thus it is trivial to access an element in constant time from its zero-based index alone.


What is the difference between primitive and non primitive data structure?

A primitive data structure is generally a basic structure that is usually built into the language, such as an integer, an array or a linked-list.A non-primitive data structure is built out of primitive data structures linked together in meaningful ways, such as a binary search tree, AVL Tree, Hashtable, etc.


How can you create array of an object in java?

Array's can hold only primitive data types. if you want a collection of objects you must use an ArrayList or a Vector.


In java is A string the same thing as a char?

No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.No.A char is a single Unicode character. It is stored as a primitive (i.e., non-object) data. A string can be considered as an array of chars - Java stores it as an object.


An array is a list of data items that all have the same type and the same name?

An array element has the same type as the array name.