Added Program 7 for Java