| | |
Accessing a variable of another class
![]() |
•
•
Join Date: Oct 2004
Posts: 15
Reputation:
Solved Threads: 0
Hi Jerbo,
Thank you for taking time to analyze all this code. I appreciate a lot.
You cannot create an object of class with an empty constructor, if the constructor of that class has parameters. We already asked the professor about this and he said think about it. Finally, someone told me that since class Record is a utility for the InventorySet class then I should do the following:
The variable "m" contains a record object then i would need to cast it to a record, and then check its checkout values. I have already done the first part.
Then here is the changes to the method and it is working now:
public void checkOut(VideoObj video) {
// TODO
Object m = _data.get(video);
Record c = (Record)m;
if(m == null || c.numout < 0 )
{throw new IllegalArgumentException();
_data.remove(video);
}
}
Have a good day Jerbo and one again thanks a lot.
Dounia
![]() |
Similar Threads
Other Threads in the Java Forum
- Previous Thread: Conver int Array into a String
- Next Thread: can no get this code to read from a file
| Thread Tools | Search this Thread |
2dgraphics 3d @param affinetransform android api applet application arc arguments array arrays automation banking binary bluetooth byte chat chatprogramusingobjects class client code color compare component count database design detection eclipse eclipsedevelopment encryption error fractal game givemetehcodez graphics gridlayout gui guitesting helpwithhomework html ide if_statement image input integer interface j2me java java.xls javadesktopapplications javaprojects jni jpanel julia keytool keyword linux list loop macintosh map method methods mobile netbeans newbie object os pong problem producer program programming project projectideas read recursion reference replaysolutions rim scanner server set size sms sort sql string swing terminal threads transforms tree ui unicode validation web windows





