Question: Variable.java a. Declare a long variable. Initialize it with a value of your choice, then print it. b. Declare a char variable. Initialize it with
Variable.java a. Declare a long variable. Initialize it with a value of your choice, then print it. b. Declare a char variable. Initialize it with the letter 'k'. Print the value. c. Declare a float variable. Initialize it by reading it in from the user. Print 2 * the number. d. Declare a constant integer equals to 12. Then declare another integer variable. Initialize it by reading it in from the user. The print the sum of the 2 values. e. Read in 3 integer values from the user. If the variables were, in order, named a, b, and c, calculate and print the result of the expression a - b % c + a / c f. Declare a double variable. Initialize it as 456.7812039. Print it out with rounding its decimal part to 4 digit. Sample run: The long value is 123456789 The char value is k Give me a float. 3.88 The twice of this float is 7.76 Now give me an int. 19 The sum of this int with 12 is 31 Now give me three int. 4 8 16 a - b % c + a / c is -4 The double is 456.7812
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
