Intro to JAVA Simple Programing 1.
Please write the code according to the instruction, suchas line of code required etc, in bold.
/**
This question practices the use of a list iterator. You have towrite
a static toString(list, index) method that makes a stringrepresentation
of a list and its iterator, where you are given the index of thenext
element that the iterator would return on a call tonext().
The expected output is
|
A|
AB|
ABC|
|ABC
|BC
B
C
BC|
*/
import java.util.LinkedList ;
import java.util.ListIterator ;
import java.util.Scanner ;
public class LinkedListTester4
{
public static void main(String[] args)
{
LinkedList<String> list = new LinkedList<String>();
ListIterator<String> iterator = list.listIterator() ;
System.out.println(toString(list, iterator.nextIndex())) ;
iterator.add(“A”) ;
System.out.println(toString(list, iterator.nextIndex())) ;
iterator.add(“B”) ;
System.out.println(toString(list, iterator.nextIndex())) ;
iterator.add(“C”) ;
System.out.println(toString(list, iterator.nextIndex())) ;
iterator = list.listIterator() ;
System.out.println(toString(list, iterator.nextIndex()))
PayPal Gateway not configured
PayPal Gateway not configured