Exercise for Java