I have created generic SingleLinkedList to store my own created objects from the class I wrote.
The problem is I don't know how to display that objects in a generic SingleLinkedList.

I tried T.getClass(). etc but I failed.

Thanks.

Edit:

```
if(head.getData() instanceof Company) 
    {
        if(head!=null) 
        {
            Node<T> temp=head;
            while(temp!=null) 
            {
                Company comp=(Company) temp.getData();
                System.out.println(comp.getName());
                temp=temp.getNext();
            }
        }
    }

```

This is the current statements that is working for my case
I'm curious about is there a another approaches for this kind of intention.

Thanks for the answer below,I used "instanceof"