Practicing oop in java