A homework of Java with interface