working part1.java