Write a java program using java.util package to add these elements to linked list {KKU, KSU, KAU, NU} then add -KAUSTI to index 2 and remove the KKU element.
import java.util.LinkedList;
public class TestLL {
public static void main(String[] args) {
LinkedList<String>list=new LinkedList<>();
list.add("KKU");
list.add("KSU");
list.add("KAU");
list.add("NU");
list.add(2, "KAUSTI");
System.out.println(list);
list.remove("KKU");
System.out.println(list);
}
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
Get Answers For Free
Most questions answered within 1 hours.