class Delete{ Node first, last,t; static class Node{ int data; Node next; Node(int d){ data = d; next = null; } } void create(int a[], int n){ first = new Node(a[0]); last = first; for(int i=1;iLength(n)){ return; } if(index ==1){ first = first.next; } else{ for(int i=2; i<=index; i++){ q = n; n = n.next; } q.next = n.next; x = n.data; System.out.println(x); } } public static void main(String[] args){ Delete l = new Delete(); int a[] = {2,3,4,5}; int n = a.length; l.create(a,n); l.Delete(l.first,2); l.Display(l.first); } }