An exercise of java