What would be the output of the following code?
KWLinkedList list = new KWLinkedList ();for(int i = 1; i <= 4;="">=> list.add( i );ListIterator iter = list.listIterator();while(iter.hasNext()){ int x = iter.next(); int y = iter.next(); iter.set(x + y);}while(iter.hasPrevious()) System.out.print(iter.previous() + " ");
for(int i = 1; i <= 4;="">=>
list.add( i );
ListIterator iter = list.listIterator();while(iter.hasNext()){ int x = iter.next(); int y = iter.next(); iter.set(x + y);}while(iter.hasPrevious()) System.out.print(iter.previous() + " ");
while(iter.hasNext())
{
int x = iter.next();
int y = iter.next();
iter.set(x + y);
}
while(iter.hasPrevious())
System.out.print(iter.previous() + " ");
7 3 3 1
1 3 3 7
1 2 3 4
4 7 2 3
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here