because he is casting the result of integer division. 1/365 = 0.002739726027397260273972602739726. but since its integer division, the result is zero. But by casting it as a double, you get the decimal places.
Both 1 and 365 are integers, so dividing them would give you an integer result, meaning, a result without any floating point numbers. In this case however, you do want floating point values.
In order to do so it suffices to make one of the two numbers a "more precise" data type, such as double.
In this case 1 is explicitly casted to a double by you, the programmer, which will cause the compiler to implicitly cast the 365 to a double also.
This way, you get a double by double division, returning a double result.