# data[].attributes.body
class NOD{
public int data;
public NOD link;
}

class QUEUE{

public NOD front, rear;

public QUEUE(){
front = null;
rear = null;
}

public static void main(String args[]){

QUEUE obj = new QUEUE();
obj.enqueue(10);
obj.enqueue(13);
obj.enqueue(15);
obj.enqueue(16);
obj.count();

}

public void enqueue(int d){
NOD newptr = new NOD();
newptr.data = d;
newptr.link =null;
//System.out.println(newptr.data+"-->");

if(rear== null){
front=newptr;
rear = newptr;
System.out.print(front.data+"-->");

}
else{

rear.link = newptr;
rear= newptr;

System.out.println(rear.data+"-->");
}

}// data masuk

// data keluar

public void dequeue(){

NOD temptr;
if (front==null)
System.out.print("Giliran kosong");
else {
temptr = front;
front= front.link;
temptr= null;

}

}

public void count(){

int sum = 0;
while (front!=null){
dequeue();
sum++;
}
System.out.println("Bilangan ="+sum);

}

}

# data[].attributes.body
Absent

Zarina

Aris

Shamier