Help.... cant access object

public void getProduct(Product item)
     this.product = item;
     System.out.println(this.product);
public boolean orderProduct(int productCode, int orderAmount)
     boolean validOrder = false;
     if(this.product == null)
          return validOrder;
     else if(this.product.getInitialQuantity() < orderAmount)
     System.out.println("Product stock is not enough to be ordered");
     System.out.println("Sorry for any inconvenience");
     return validOrder;
     }else
          validOrder = true;
     return validOrder;
I try to access the this.product object in getProduct( ) from orderProduct( ) but it return null
these both method are in the same class
when I do print method in getProduct( ), it display the product but when it come to orderProduct( ), it is null
how can I access this.product from orderProduct?
thanks

And use the code formatting tag please. Makes it much easier to read code on the forum.

Similar Messages

Maybe you are looking for