Hamlet is a very complex character, and even towards the end of the play, I still hadn't completely figured him out! The entire graveyard scene provides us with a lot of insight into Hamlet's thoughts and character. Everything from the way he refers to others, speaks to others, his overall physical actions, and his thoughts that are told to us directly give us a little bit of insight regarding his character.
When Hamlet first enters the scene and begins speaking with the first grave digger, the he begins gossiping about how the rumor is that Hamlet had gone insane. Some people would have stopped the man, told him that he was talking about them, and then may or may not have asked the man questions about the rumors he heard. Hamlet however, choses to let the man continue talking without the knowledge of his true identity. This can be added to the pile of other occurrences that have led readers to infer that Hamlet is rather indirect.
The only time we really truly know what Hamlet is thinking is during his soliloquy's (and even then you can't be a hundred percent sure). At any other point in time it is very difficult to tell whether he is being sincere or if he's simply 'piling it on'.
It is quite apparent that Hamlet is going through mental and ethical turmoil throughout the entire play. He is also obsessed with rotting and decay, both physical and moral. When watching the grave digger do his work, he takes note of the fact that he is singing, while doing work that would not cause most people to want to sing. He speaks of how the man must sing because he is accustomed to the gloom and sorrow attached to his work and it no longer bothers him. His sense of morals and decency are decaying. He is definitely still not over the death of his father and the new circumstance surrounding how his father died is probably not helping him much eitherThe soliloquy made while he is holding the skull of Yorick, who was once a jester in his fathers court, is probably more insightful than any other occurrence during the graveyard scene. It talks of issues similar to those mentioned in the 'To be or not to be' soliloquy, but it goes in a slightly different direction. Yorick was once a funny, personable figure that entertained Hamlet throughout his childhood and now he was merely a skull, whose remains were being treated no better than the dirt he was buried in, being shown no respect, and becoming part of the earth. He starts to understand that it does not matter whether a person is nobility, a servant, or a peasant, they all end up dirt in the end anyway. Anything a person has in this life, will not come with them to the next life: but how can you know for sure?