Search Interview Questions | Click here and help us by providing the answer. Click Correct / Improve and please let us know. |
|
|||
|
| ||||
| Core Java - Interview Questions and Answers for 'Arraystoreexception' - 2 question(s) found - Order By Newest | ||||
| ||||
| Ans. It's an exception that is thrown when we attempt to add value of an incompatible type to an array. For example - Object[] strArray = new String[2]; strArray[0] = 5; In this code, strArray reference of type Object has currently been assigned the String array but at line 2 we are trying to add an integer value. | ||||
Object[] strArray = new String[2]; strArray[0] = 5; | ||||
| ||||
| Ans. No. But It will throw ArrayStoreException at runtime. | ||||