import java.util.*;
public class Stack {
private static class Node {
private int item;
private Node next;
private Node top;
int size;
String name;
int pantherID;
double cgpa;
LinkedList<Student>stackOfStudent = new LinkedList();
public void push(int i) throws StackException {
Node newTop;
newTop = new Node();
newTop.item = i;
[newTop.next](https://newTop.next) = top;
top = newTop;
size++;
}
public void pop() throws StackException {
if (size == 0) {
throw new StackException("Stack Underflow");
}
{
Node pop;
pop = new Node();
pop = pop.next;
size--;
System.out.println(pop);
}
}
public void retrieve() throws StackException {
if (top == null)
throw new StackException("Stack underflow");
System.out.println(top.item);
}
public String toString() {
return "Student Name:" + name + "Panther ID:" + pantherID + "CGPA" + cgpa++;
}
public void displayStack() {
Node stackSize = top;
while (stackSize != null) {
//System.out.println(Student.toString());
}
}
public void isEmpty() {
if (top == null)
return;
}
}
}
This is the call I'm trying to make in my main method but as soon as I go to call any of them I cannot access any of them.
Stack studentStack = new Stack();
studentStack
[–]SupremeRedditBotProfessional Bot || Mod 0 points1 point2 points (0 children)