code examples for java oop principles