Will this give compile time error ?<br /> <br /> Object[] strArray = new String[2];<br /> strArray[0] = 5;

Search Interview Questions

 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text


Java - Interview Questions and Answers

 Q1. Will this give compile time error ?

Object[] strArray = new String[2];
strArray[0] = 5;
Core Java2018-07-25 08:17:03

Ans. No. But It will throw ArrayStoreException at runtime.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     ArrayStoreException  arrays

Related Questions

 What is the difference between ArrayIndexOutOfBoundException and ArrayStoreException?
 What is ArrayStoreException ?

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: