why iterator in java if we for loop?
The collection always has a getter armed with the iterator's next value. Much of the collection's internal implementation is done via the iterator.Iterators are saferand used only with collections as they have a little more flexibility since you can go backwards and forwards with them. It will allow you to remove an element.
1)An interface contain only abstract methods and constants. But abstract class contain zero or more abstract methods and also class level variables like instance,static and constant variables.
2) interface does not contain any constructors. But abstract class must contain the constructor.
3) It is not possible to create object to both interface and abstract class. But it is possiblt to invoke the abstract class constructor by using it's subclass constructor.
4) to forcing the all developers to use perticular methods prototypes we use interface. There are two senarios are their to declare the class as abstract. The first one is , can not allow any one to creat the object to class directly. The another one is a class contain the abstract methods.