Question: it says here static so it as user , so only i will call the methods public class Node { public T data; public Node
it says here static so it as user , so only i will call the methods
public class Node
public T data;
public Node
public Node() {
data = null;
next = null;
}
public Node(T val) {
data = val;
next = null;
}
// Setters/Getters?
}
public class LinkedQueue
private Node
private int size;
/** Creates a new instance of LinkedQueue */
public LinkedQueue() {
head = tail = null;
size = 0;
}
public boolean full() {
return false;
}
public int length (){
return size;
}
public void enqueue(T e) {
if(tail == null){
head = tail = new Node
}
else {
tail.next = new Node
tail = tail.next;
}
size++;
}
public T serve() {
T x = head.data;
head = head.next;
size--;
if(size == 0)
tail = null;
return x;
}
}
4. Write the method public static
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
