Search Interview Questions | Click here and help us by providing the answer. Click Correct / Improve and please let us know. |
|
|||
|
| ||||
| Interview Questions and Answers | ||||
| ||||
| Ans. We are not resizing the first array here but assigning the reference strArray to a new Array with size 5. So after line 2, We have 2 arrays in memory, one with size 2 and other with size 5 with strArray referring to second array with size 5. | ||||
String[] strArray = new String[]; | ||||
String[] strArray = new String[]{"Buggy","Bread"}; | ||||
String[] strArray = new String[3]{"Buggy","Bread"}; | ||||
String[] strArray = new String[2]; strArray.length = 5; | ||||