java and scala inheritance trials