[SalesForce] Method must define a body error

I have a simple piece of code but I'm getting an error:

Compile Error: Method must define a body at line 28 column 25.

I'm new to Salesforce development and can't figure out this error

global with sharing class MyController {

    public String allSectors {
        get {
            List<String> sectors = GetSectors();
            allSectors = '';
            for (String i : sectors)
            {
                if (allSectors == '')
                {
                    allSectors = i;
                }
                else
                {
                    allSectors += ',' + i;
                }
            }
            return allSectors;
        }
        set;
    }

    public MyController()
    {
        //do something
    }

    public List<string> GetSectors();
    {
        List<String> sectorList = new List<String>();
        //populate list
        return sectorList;
    }

    @RemoteAction
    global static String GetSectorDetails(string sectorName)
    {       
        return 'something';
    }
}

Any help will be highly appreciated.

Best Answer

Remove ";" from

public List GetSectors();
. You can't have ";" for method names.

global with sharing class MyController {

    public String allSectors {
        get {
            List sectors = GetSectors();
            allSectors = '';
            for (String i : sectors)
            {
                if (allSectors == '')
                {
                    allSectors = i;
                }
                else
                {
                    allSectors += ',' + i;
                }
            }
            return allSectors;
        }
        set;
    }

    public MyController()
    {
        //do something
    }

    public List GetSectors()
    {
        List sectorList = new List();
        //populate list
        return sectorList;
    }

    @RemoteAction
    global static String GetSectorDetails(string sectorName)
    {       
        return 'something';
    }
}
Related Topic