Java programming question attached

Java programming question attached