Hamlet is full of dramatic irony.
The first example is when the audience knows that Hamlet is feigning madness, but the other characters are unaware. This is an example of dramatic irony because it’s a situation where the audience knows something that the characters don’t, but both the audience and the characters know it. So it’s not just dramatic irony; it’s also dramatic irony with knowledge shared between two groups of people.
Another example is when Hamlet knows that Rosencrantz and Guildenstern are spying on him, but they think he is unaware. In this case, we can say that there is one group of people who know something (Hamlet) and another group of people who don’t know what those first people know (Rosencrantz and Guildenstern). This is yet another example of dramatic irony—one where there are two groups who know different things.
Another example happens when Claudius thinks Hamlet doesn’t know about his murder of King Hamlet while Hamlet actually does know about this murder and plans to take revenge on Claudius for committing it. This is another example of dramatic irony.