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
Charles McDowellCharles McDowell 

Expecting a semi-colon found <eof>

I am new to salesforce and I wrote a class and I keep getting the error:  Expecting a semi-colon found <eof>. Can anyone tell me what the problem is.

public class FileSetup {
   static List<Category__c> cat = new List<Category__c>();
      
    Public FileSetup(){
       cat =  [Select ID, Category__c from category__c];
    }
   static void runSetup(){
       FileSetup obj = new FileSetup() ;
       for(Category__c c : filesetup.cat){
            system.debug(c.id);  
       }
   }
}
DixitDixit
i just made a "Category" object in my dev edition and copied your class and i get no error. 
Try saving again (?)
Charles McDowellCharles McDowell
Yes, this is what is strange. I had a much more complicated class: it ran no problems.  I added some code to the class the next day and I started getting this error.  I removed lines of code to determine where the error was; same error.  I wrote this simply class and I still get the same error. I am confused!
DixitDixit
Are you sure the error is in that class?
If there are others developers using your same sandbox the console will show the error for everyone, not just for you. 
On the first column it says the name of the class which is giving the error.
Charles McDowellCharles McDowell
I am using developer version, so I am the only one. There error not seem to be in the code. I am running it from the anonymous window with the command:  Filesetup.runSetup(). Could it be an anonymous window problem.
DixitDixit
I don't know, but try to stop the processes in the "progress" tab in your developer console and click "Cancel all Deployments" and try to save it/run it again.
Let's see if that helps
Charles McDowellCharles McDowell
Tried it; didn't work. I have no idea what's going on.