function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vigneshwaran LoganathanVigneshwaran Loganathan 

Hi I am new to salesforce, as you can see this is a simple one, i could not understand what is tha unexpected token here, help me out :( Error: Compile Error: unexpected token: public at line 5 column 2

public interface PurchaseOrder {
    Double discount();
  }
  
public class CustomPurchaseOrder implements PurchaseOrder {
  
    static final double DEFAULT_DISCOUNT = .05;
        
    public Double discount() {
      return DEFAULT_DISCOUNT;
    }
      
 }
Best Answer chosen by Vigneshwaran Loganathan
Bhushan.AdhikariBhushan.Adhikari
If you are writing this in a single class, then you bound to get that error. Both should be different classes.

All Answers

Bhushan.AdhikariBhushan.Adhikari
I copied your both classes and it did not gave any error to me.
Bhushan.AdhikariBhushan.Adhikari
If you are writing this in a single class, then you bound to get that error. Both should be different classes.
This was selected as the best answer
Vigneshwaran LoganathanVigneshwaran Loganathan
Thanks a lot Bhushan :) You are great :)