Possible Duplicate:
Java: What does the colon (:) operator do?
for (CreditCard cc : credit1)
&
if (index instanceof RewardCard)
is “:” and instanceof the same? so I could use?
if (index : RewardCard)
or
for (CreditCard cc instanceof credit1)
if not, can someone explain what the “:” mean?
They’re not the same:
instanceofchecks if an instance of an Object is of a certain type. The:infor (CreditCard cc : credit1)is a short way to loop through a List (foreachloop).