RE: interfaces help 11-27-2013, 03:08 AM
#21
Okay. The @override is how you override a method in Netbeans. Override simply means that the method is inherited but you don't want to use the inherited code, you want to use your own code which you provide.
Next, what is the scope of the name variable? is it local or an instance variable? If its local in another method you can't use it in a different method.
Lastly, since you did an override on toString() I'm not sure if you can use it in the same manner. You may have to use it as a regular method (i.e. toString(purchasePrice);
This seems weird because from what you are saying you need to create a toString() when one already exists.
Maybe you can choose a different method name other than toString but use toString() in that method. You will get the result you need without the headache and without overriding toString().
Next, what is the scope of the name variable? is it local or an instance variable? If its local in another method you can't use it in a different method.
Lastly, since you did an override on toString() I'm not sure if you can use it in the same manner. You may have to use it as a regular method (i.e. toString(purchasePrice);
This seems weird because from what you are saying you need to create a toString() when one already exists.
Maybe you can choose a different method name other than toString but use toString() in that method. You will get the result you need without the headache and without overriding toString().