object returned but cannot access its methods?

Three classes pasted below, this is a linked list implementation. I have a button on my GUI that should inform the user of the object in the front of the queue. I cannot access the methods of an employye object? Any pointers?

Tks,
Owen.


private void frontButtonActionPerformed(java.awt.event.ActionEvent evt)
 {
myQueue.front();
How do I access the methods or properties of my employee object?????
Netbeans autocomplete won't bring up any of these? I want to put one of it's
}
public class Node {
    private Object element;
    private Node next;
    
    public Node()
    {
        this(null,null);
    }
    public Node(Object e, Node n)
    {
        element = e;
        next = n;
    }
    public void setElement(Object newElement)
    {
        element = newElement;
    }
    public void setNext(Node newNext)
    {
        next = newNext;
    }
    public Object getElement()
    {
        return element;
    }
    public Node getNext()
    {
        return next;
    }
   
    }
################################################
 
public class Employee {
    private  int age,empNum;
    private String fName, lName;
    
    public Employee(int empNum, String fName, String lName, int age)
    {
        this.age = age;
        this.empNum = empNum;
        this.fName = fName;
        this.lName = lName;
    }
    
    public String getName()
    {
        String joinName;
        joinName = fName + lName;
        return joinName;
    }
    public int getAge()
    {
        return age;
    }
    public int getEmpNum()
    {
        return empNum;
    }
    @Override
    public String toString()
    {
        return empNum+ "\t" + fName+ " " + lName+ "\t" + age + "\n";
    }
 
}
##################################################
 
public class LinkedQueue 
{
    private Node head, tail;
    private int qSize;
    
    public LinkedQueue()
    {
        head = tail = null;
        qSize = 0;
    }
    public int size()
    {
        return qSize;
    }
    public Node getTail()
    {
        return tail;
    }
    public boolean isEmpty()
    {
    return ( head==tail );
    }
    public Object front() throws QueueEmptyException
    {if (isEmpty())
        throw new QueueEmptyException("Queue is empty");
     else
         return head.getElement();
    }
    
    public void append(Object obj)
    {
    Node node = new Node();
    node.setElement(obj);
    node.setNext(null);
    if(qSize == 0)
        head = node;
    else 
        tail.setNext(node);
    tail = node;
    qSize++;
    }
    public Object serve()throws QueueEmptyException
{
    Object obj;
    if(qSize == 0)
        throw new QueueEmptyException("Queue is empty");
    else 
    {
        obj = head.getElement();
        head = head.getNext();
        qSize--;
    }
    if(qSize == 0)
        tail = null;
    return obj;
    
}
}

Open in new window

OwenMoriartyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jazzIIIloveCommented:
Hi there;

Are they in the same package? What is the error line...could you write it here?

Best regards...
0
OwenMoriartyAuthor Commented:
C:\Documents and Settings\Me\My Documents\saprac\prac2\src\gui.java:217: cannot find symbol
symbol  : variable anEmployee
location: class gui
statusLabel.setText(anEmployee.getName());

Tks,
Owen.
0
OwenMoriartyAuthor Commented:
Sorry, original post does not have code that gives error.

Line 217:statusLabel.setText(anEmployee.getName());
0
jazzIIIloveCommented:
Hi there;

So exactly in which class (possibly main class i think) you are creating the object?..The class referring the anEmployee seems valid to me, accessors and mutators are valid...This leads me to think that you create your variable that tthe referenced class is not visible...So issue is visibility it seems...I think they are not in the same package...Maybe some classes are in <default package>, some are in another package...Let them in the same package group...If there are any other project, close them and be sure your project is the active project...

If you can send the snippet that you create your object, maybe we can process better...

Best regards...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.