|
-
Apr 16th, 2007, 10:20 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] why use and not use new in making array
I am reading on arrays and have a question about them. The line below does not use the new keyword. Does that make it any different of an array object than the example below it that uses new to create the object reference?
int[] nums = { 99, 10, 100, 18, 78, 23,
63, 9, 87, 49 };
int[] nums = new int[] { 99, 10, 100, 18, 78, 23,
63, 9, 87, 49 };
From what I read, new is for making references to the object as memory is allocated for it. We don't use new when creating variables and assigning them a value but we do need new for referencing of objects to a variable.
I am confused why array objects can be done either way. Whats so special about them or maybe I should ask what further understanding do I need about this concept.
Thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|