In: Computer Science
Describe/define/explain
a. The relationship between Java's Iterable and Iterator
interfaces
b. An inner class
c. An anonymous inner class
d. The functionality of an Iterator remove method
a. The relationship between Java's Iterable and Iterator interfaces
public interface Iterable<T>
{
Iterator<T> iterator();
}
public interface Iterator<E>
{
boolean hasNext();
…
…
void remove();
}
Class outer{
Private class Inner
{
//data members and methods of Inner class
}
}
Eg
abstract class A{
abstract void fun();
}
class Anonymous_Inner{
public static void main(String args[]){
A obj=new A(){
void fun(){System.out.println("Testing ");}
};
obj.fun();
}
}