So, I'm creating a program that allows users to specify the insurance cover they want as part of an insurance policy. As part of it, I need to use a map in order to track the owner of each specific insurance policy.
I have seen examples of how to use a map with regards to String and int values, but nothing for self made classes (InsurancePolicy in my case).
So, I'm trying to do it like this, but I get the illegal expression warnings:
Map coverOwnerMap();
Any help would be very appreciated.
解决方案
Right, that's invalid Java. Try,
Map coverOwnerMap = new HashMap();