Search code examples
javaintsalesforceapex-code

save error: Invalid type: int


public int getSelected2()
{
    //selectedAssets.clear(); //
    for(assetswrapper accwrapper : assetsList)
        if(accwrapper.selected == true)
            selectedAssets.add(accwrapper.acc);
    int a;
    a = selectedAssets.size();
    return a;
}

When I try to compile the following piece of code, I get this error:

Save error: Inavlid type:int.

This is in Salesforce. I'm not sure what the problem is?


Solution

  • I supposed you are using apex since you tagged the question as salesforce.

    Apex is not Java, it has not type int

    Try by using Integer

    More Apex primitive types: http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_primitives.htm