+ Start a Discussion
Sammy7Sammy7 

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
Sammy7Sammy7
Contructor is required. nvm.