updated code according to eclipse java