Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
My question is this; b is an integer, c is a double. the video states that any arithmetic operation involving an int and double ends in a double. so int 2 * double 3.5 = double 7.0 but this can not be done without a cast? and now I have another int, int 3 being divided by double 7 with no cast. shouldn't this throw an explicit conversion error and not compile? i entered different answers for the problem but got it wrong each time. does anyone know the solution. Thank you.
Christian Mangeng15,969 Points
if at least one of the two numbers is a double, the result will automatically be of type double. This does not require to convert the integer to a double. Therefore, no conversion error will result when dividing an int by a double.