Use the following problems to test your type inference programming prowess. I strongly encourage you to give each problem a try before you turn to the solutions and download the example programs:
- Simple var example: Write a program that exemplifies the correct usage of type inference (var) with respect to the code's readability.
- Using var with primitive types: Write a program that exemplifies the usage of var with Java primitive types (int, long, float, and double).
- Using var and implicit type casting to sustain the code's maintainability: Write a program that exemplifies how var and implicit type casting can sustain the code's maintainability.
- Explicit downcast or better avoid var: Write a program that exemplifies the combination of var and explicit downcast and explain why var should be avoided.
- Avoid using var if the called names don't contain...