Different Exercises with their solution in JAVA