F-J-K
asked on
Array of Variables vs. Array of Object - VB.NET
1. Can you please explain the differences between the following array declarations and which is declaration correct?
Private courseList As Course() = New Course(5) {}
Private courseList(5) As Course()
2. I want i know is both declarations allow courseList to carry a reference to the actual object.
3. What about this one: Dim values() As Integer = {1, 2, 3}
Integer is a class, so what values will hold in here? Will it hold the actual number (1,2,3) or their references? If values hold the actual numbers 1,2,3 then Integer is not a class datatype, its a primitive because as i know array can hold actual values of primitive datatype values. Can you please clarify..
Thanks
Private courseList As Course() = New Course(5) {}
Private courseList(5) As Course()
2. I want i know is both declarations allow courseList to carry a reference to the actual object.
3. What about this one: Dim values() As Integer = {1, 2, 3}
Integer is a class, so what values will hold in here? Will it hold the actual number (1,2,3) or their references? If values hold the actual numbers 1,2,3 then Integer is not a class datatype, its a primitive because as i know array can hold actual values of primitive datatype values. Can you please clarify..
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok. Is String considered as a primitive datatype? What i know primitive datatype doesn't have attributes/behaviors. String variable can call various methods such as Substring, trim, etc, so to me
i see String as a class.
i see String as a class.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, what gets stored in values? (Dim values() As String = {"xxx", "yyy", "zzz"})
values(0) carries "xxx"? or carries a reference to "xxx"? I hope my question is clear
values(0) carries "xxx"? or carries a reference to "xxx"? I hope my question is clear
ASKER
Discard my last question. Thanks
ASKER
Thanks. Discard my last question
ASKER
What about String? There is String and string. Dim values As String = New String(3) {"xxx", "yyy", "zzz"}
Will these 3 values be stored as they are?