Howto: Display code in wordpress

I’ve been wanting to add some code examples but the difficulty of working with code in the wordpress editor has made me shy away from it.

Until I saw:

That was a lot easier than I imagined.

public class hello(){

int a;
int b;
a= a+b;