I need to create a SETTER method within Class B to set a new price for particular Product object which is stored in array defined in Class A. Can anyone help with this basic java code? Let's assume that we create Product apple and we need to change its price. I need to use something like:
setPrice (product name, price);
Here is scenario:
Class A
public class Store(){
Store(Product aProduct){
products = new ArrayList< Product> ();
}
}
Class B
private String name;
private int price;
public class Product {
Product ( String aName, int aPrice) {
name = aName;
price = aPrice;
}
}
Thanks very much.
aProductthat doesn't use ? Is classBaProduct?