Question: Using the following class in Java, create a refererence based queue consisting of 5 node, then perform the following operations: 1 . Add 5

Using the following class in Java, create a refererence based queue consisting of 5 node, then perform the following operations:
1. Add "50" to the Queue
2. Remove any node from the queue and display its value
3. Add "10" to the Queue
public class PrintNode {
private String job;
private PrintNode link;
public PrintNode ()
{
job = null;
link = null;
}
public PrintNode (String job)
{
this.job = job;
link = null;
}
public PrintNode(String data, PrintNode link)
{
this.job = data;
this.link = link;
}
public void setLink(PrintNode newLink){
link = newLink;
}
public void setData(String newData){
job = newData;
}
public PrintNode getLink(){
return link;
}
public String getData(){
return job;
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!