Update Part2.java

update final code