I am doing a homework assignment (I am not one to lie) and I am honestly stumped at the questions. I have 3 years of programming experience but am stumped on some of the simplest problems in the class, lol. New to Java, not new to programming rather. I would like to discuss why the questions result in an answer and why it is one way or another.
1) Write 3.4, is this a double or a float?
I want to say its a float by default, as it takes up less space (32 bits) versus a double (64) bits. Since 3.4 is a small number, I would assume it is a float?
2) Declare x as a double and assign it the value of 3.4 (as a double).
I think it is double x = 3.4d;
not 100% sure on this
3) Declare y as a float and assign it the value 3.4 (as a float).
Similar to above, i think it is float y = 3.4f;
Not usually one to come on here and ask for HW help in this manner...but I have no textbook for another week as I just ordered it. I would rather like to discuss why it is one way or another so I can get a better understanding of how Java works. Thanks.