Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

instantiation in C#

Status
Not open for further replies.

BioHazard90

Programmer
Nov 24, 2008
2
0
0
US
class MyProgram
{
static void Main()
{
int[] integers; // declare array
integers = new int[10]; // size array
}
}

In which line is the array actually instantiated?
 
before the line int[] integers; nothing exists. after that the variable exists (instantiated?), but is null, a value has not been assigned. after integers = new int[10]; the variable has been initialized.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
In your code, initialization happens on the 2nd line. Class level fields however takes their default values.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top