Due Date: Thursday, February 10, 2005, before the beginning of your lecture section.
Goal: the goal of this assignment is to learn how to deal with numbers in Java.
1. What will be the result of the following expressions:
(a) 2/1/4(b) 2.0/1.0/4.0
(c) a++ (if a was originally 2)
(d) --a (if a was originally 2)
2. Let a be a variable of type int. Use type casting to assign a's value to the following variables:
(a) longA of type long
(b) doubleA of type double
(c) stringA of type string
Explain in which of these three cases we can use type conversion instead of type casting. If type conversion is possible, what is the advantage of type casting?