+ Start a Discussion

Whats wrong with this code?

I can excute this fine in excute anonymous, but when I put it in the class, I get "Unexpected token: '='" at LINE 5
public class testProduct {
    public Product2 shipping {get;set;} 
    shipping = [SELECT id, name, productcode from PRODUCT2 where productcode='shipping' limit 1];

Best Answer chosen by Sammy7
Contructor is required. nvm.