I quote wiki :
Soon after Newton had obtained his B.A. degree in August 1665, the university temporarily closed as a precaution against the Great Plague. Although he had been undistinguished as a Cambridge student,[15] Newton's private studies at his home in Woolsthorpe over the subsequent two years saw the development of his theories on calculus,[16] optics, and the law of gravitation.