Microsoft Interview Question
Software Engineer / Developersyep sur is right, when we declare an array of object, we have to redefine each element separately and also i think x should be declared static since we are directly using it with the class name, can anybody confirm that
The problem is in class C
class c
{
b B1[]=new b[3];
}
when class C is instantiated, 3 new reference variables are created (in stack), but they don't point to any object(in heap). So C1.B1[0].x will throw npe
doesnt look like a Microsoft question !!!
- Anonymous February 03, 2010