-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment104_.java
More file actions
38 lines (25 loc) · 933 Bytes
/
Assignment104_.java
File metadata and controls
38 lines (25 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package abhilash_Asignments;
import java.util.ArrayList; //import array list
import java.util.ListIterator;
//PLease use backward iteration using listiterator for arraylist without farward iteration and note down the error?
public class Assignment104_
{
public static void main(String[] args)
{
// Create an ArrayList
ArrayList a1 = new ArrayList();
a1.add("Abhilash");
a1.add("Welcome");
a1.add("to");
a1.add("automation");
a1.add("testing");
System.out.println( );
// ListIterator method
ListIterator a2 = a1.listIterator(); //using ListIterator
// Attempting to iterate backward through the list without forward iteration
while (a2.hasPrevious())
{
System.out.println(a2.previous());
}
}
}