Object Oriented Programming practice in Java