Arrays are reified in Java -


i came across that, arrays reified in java. is, know type information during run time. little confused definition.

if arrays said know type information during runtime, should literally able assign values arrays, since typing known @ run time errors thrown @ run time only. not case in real time. compile time error that.

so can throw light on "what mean - arrays reified"?

what think means given lines of code throw exception:

string[] arrayofstrings = new string[10]; object[] arrayofobjects = arrayofstrings; // compiles fine arrayofobjects[0] = new integer(2); // throws runtime exception (arraystoreexception iirc) 

arrays covariant: string[] extends object[]. actual type of array known @ runtime, , attempt store instance not of right type throws exception.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -