+ 2
Creating Objects without using the new keyword?
This part of the code Iterator<String> it = animals.iterator(); I do not understand this part how can you use animals.iterrator without the new keyword...is it calling a constructor here without the new keyword? because I read from using the new keyword this prompts the IDE to create a space on the Heap for the object
1 Respuesta
+ 3
This statement is just like
String f=intF.toString();//intF is an int variable
Similarly here you are creating a member of Iterator class named it,and using iterator method of animals object(List object).