What is framework
Framework is large body (usually many classes) of pre-written codes to which you add your own code to solve a problem in specific domain. A framework inprogramming is a set of tools that provides ready made and customizable components to speed up development process. Framework is set of codes which provides basic fuctionality to boost up productvity.
Why to use framework
Framework generally reduces time and energy and using framework provides a system which already contains many best practice codes and structures. Framework reduces time and risk of errors because it is already optimized and tested.
Difference between framework and library
Library is set of reusable codes that you put or include in your project to access specific functionality on other hand you put your code inside framework to access structure for your project.
Popular java framework
Following are the most popular java frameworks