67 216
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #4817 in Java | JSP | JSF for anthony hector

Question #4817
link list in java of length,n.a number,m is given and the program needs to on the mth node remove the node and continue doing so until the last node remains.
Expert's answer
import java.util.LinkedList;


public class Question4817 {

public static LinkedList list = new LinkedList();


public static void inputData(){
& list.add("Fisrt");
& list.add("1");
& list.add("Second");
& list.add("3");
& list.add("Four");
}

public static void removeData(){
& while(!list.isEmpty()){
& System.out.println(list.peek() + " removing");
& list.poll();
&
& }
}

public static void main(String[] args) {
& // TODO Auto-generated method stub
&
& inputData();
& removeData();
& System.out.println("Done!");

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions