▁ ▁is ▁a ▁; ▁ ▁invariant : ▁an ▁ ▁is ▁not ▁a ▁ ▁and ▁a ▁ ▁is ▁not ▁an ▁. ▁ ▁If ▁we ▁wish ▁to ▁avoid ▁type ▁errors , ▁then ▁only ▁the ▁third ▁choice ▁is ▁safe . ▁Clear ly , ▁not ▁every ▁ ▁can ▁be ▁treated ▁as ▁if ▁it ▁were ▁a ▁, ▁since ▁a ▁client ▁reading ▁from ▁the ▁array ▁will ▁expect ▁a ▁, ▁but ▁an ▁ ▁may ▁contain ▁e . g . ▁a ▁. ▁So ▁the ▁cont rav ari ant ▁rule ▁is ▁not ▁safe . ▁ ▁Con vers ely , ▁a ▁ ▁cannot ▁be ▁treated ▁as ▁an ▁. ▁It ▁should ▁always ▁be ▁possible ▁to ▁put ▁a ▁ ▁into ▁an ▁. ▁With ▁cov ari ant ▁arrays ▁this ▁cannot ▁be ▁guaranteed ▁to ▁be ▁safe , ▁since ▁the ▁backing ▁store ▁might ▁actually ▁be ▁an ▁array ▁of ▁c ats . ▁So ▁the ▁cov ari ant ▁rule ▁is ▁also ▁not ▁safe — the ▁array ▁constructor ▁should ▁be ▁invariant . ▁Note ▁that ▁this ▁is ▁only ▁an ▁issue ▁for ▁mutable ▁arrays ; ▁the ▁cov ari ant ▁rule ▁is ▁safe ▁for ▁imm utable ▁( read - only ) ▁arrays . ▁ ▁Cov ari ant ▁arrays ▁in ▁Java ▁and ▁C # ▁ ▁Early ▁versions ▁of ▁Java ▁and ▁C # ▁did ▁not ▁include ▁gener ics , ▁also ▁term ed ▁paramet ric ▁polym orphism . ▁In ▁such ▁a ▁setting , ▁making ▁arrays ▁invariant ▁rules ▁out ▁useful ▁polym orph ic ▁programs . ▁ ▁For ▁example , ▁consider ▁writing ▁a ▁function ▁to ▁sh uffle ▁an ▁array , ▁or ▁a ▁function ▁that ▁tests ▁two ▁arrays ▁for ▁equality