Ok, I think I might understand you now.
I think you would need to do the following:
Record c = <strong>new Record(</strong>);
Record r = c.copy();
The reason for the 'c' not initialized, is because you only create a variable for 'c' of type Record. However the JVM only allocates memory for the object (but nothing is initilized.) You need to instaniate the object with the NEW keyword to create a functional object from the class. Once you have an instance of the class, you can work with its instance members.
That would at least take care of the variable not initilized. Now for the IllegalArgumentException. If I understand the rest, you should then have:
Record c = new Record();
Record r = c.copy();
if(m == null || r.numOut < 0) {
throw new IllegalArgumentException();
}
Since 'm' is representitive of "_data.get(video)" then I suspect it should work. However I am not familure yet with 'Map' as I am in a Java certification class myself. We haven't covered this yet.
My only other question is when you create a 'Record' object, will it always be initilized with your (VideoObj video, int numOwned, int numOut, int numRentals) set? If so then should you not either create a default constructor to set these, or at least define these when you create the object:
Record c = new Record(myVideo, myNumOwned, myNumOut, myNumRentals);
Another thing I though of, is should not the VideoObj (which I see no code for) not have these values? If so then you would initilize:
// Assumption VideoObj myVideo = new VideoObj();
Record c = new Record(myVideo, myVideo.numOwned, myVideo.numOut, myVideo.numRentals);
I am assuming that VideoObj is used to get the video information to be passed on to the Record().
Ok, Jerbo, enough already, I think I have analyzed this to much, and if so, I appoligize. :lol:
Anyway, I hope this helps, but I think I just beat on the same drum as before.