Java design pattern demo