Dear Sir,
I want to know that, how can i define my return type?
like
public Myreturntype fun1()
{
return Myvalue;
}
As i have already used predefined Return type like String,int But I want to know How can We make My return type?"
Actually, i was Confused with the Iterator Method in Arraylist like "Iterator itr = ArrayList.iterator();" In The ArrayList It has one of method "public Iterator iterator()" . But i m not getting How the Arraylist implements This iterator() function Because the Iterator is a interface and has only three methods boolean hasNext(), Object next() ,void remove().
As i am thinking In the Arraylist Its written like that Or something else??
public class Arraylist extends AbstarctList implements List, RandomAccess, Cloneable
{
public Iterator iterator()
{
Iterator it=new Arraylist ();
return it;
}
That is how I would do it, with an anonymous class. To find out more, unzip the file called src.zip which is in your Java installation directory and explore that. If I remember correctly, that ListIterator<T> interface extends Iterator.
please Clear me one more things that if i am doing like it "HashSet s = new HashSet();" instead of "Set s = new HashSet();".
Is there Any problem?? Or Any Suggestion you can give me as A programming concept?