Question: Exercise 2: Experimenting with the Integer Class Wrapper classes are described on Chapter 3.8 of the text. They are Java classes that allow a value
Exercise 2: Experimenting with the Integer Class Wrapper classes are described on Chapter 3.8 of the text. They are Java classes that allow a value of a primitive type to be "wrapped up" into an object, which is sometimes a useful thing to do. They also often provide useful methods for manipulating the associated type. Wrapper classes exist for each of the primitive types: boolean, char, float, double, int, long, short, and byte. Write a program IntWrapper that uses the constants and methods of the Integer class to perform the following tasks. Be sure to clearly label your output and test your code for each task before preceding. 1. Print the maximum and minimum possible Java integer values. Use the constants in the Integer class that hold these values don't type in the numbers themselves. Note that these constants are static. 2. Prompt the user to enter two decimal integers, one per line. Use the next method of the Scanner class to read each of them in. (The next method returns a String so you need to store the values read in String variables, which may seem strange.) Now convert the strings to ints (use the appropriate method of the Integer class to do this), add them together, and print the sum
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
