Primitive Wrapper Classes Exercises

  < Previous  Next >
  1. Write Java code to do the following with one or more Primitive Wrapper Classes:
    1. Declare a variable and initialize it to a responsible value
    2. Use a field of that class
    3. Use a static method of that class
    4. Use an instance method of that variable
  2. Display the smallest and largest values for the following Java data types:
    • int
    • long
    • float
    • double
  3. Write Java code to do what the comment says (without changing any of the given code):
    Scanner stdinScanner = new Scanner( System.in );
    System.out.print( "Please enter the year you were born: " );
    String birthYearStr = stdinScanner.nextLine();
    int csuBirthYear = 1958;
    
    /* Display the difference between the user's age and CSU's */