Hw 3:Bounded Generics

  • Write a generic upper bound (extends) method named add which takes two generic arguments and return sum of given two numbers
  • Call generic add method inside the main method pass the appropriate data types
  • Print the result of the add method
  • Write a method printOnlyIntegerClassorSuperClass which takes list as lower bound (super) Number argument
  • Call printOnlyIntegerClassorSuperClass on the main method and print the result
  • Write a method printwithextend which takes list as upper bound (extends) Number argument
  • Call printwithextend on the main method and print the result
  • Write a method printlist with takes list as unknown bound as an argument
  • Call printlist on the main method and print the result
  • Write a method sum with takes list as upper bound as an argument
  • Call sum on the main method and print the result
  • SAMPLE OUTPUT

Due Date :06/27/2023 11:59 PM Tuesday

How to submit Homework?

  • Add your full name and email at the top of the file using a comment tag.
  • Compile and run your program, entering the required inputs.
  • Take a screenshot of the result.
  • Zip your project with the source code, then upload it on Blackboard.
  • Upload screenshot on Blackboard.
  • Note: Submit the assignment on Blackboard by the due date. Email and late submissions will not be accepted.