java - 保存错误 : Invalid type: int

标签 java int salesforce apex-code

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

当我尝试编译以下代码时,出现此错误:

Save error: Inavlid type:int.

这是在 Salesforce 中。我不确定是什么问题?

最佳答案

我假设您正在使用 apex,因为您将问题标记为 salesforce。

Apex 不是 Java,它没有类型 int

尝试使用 Integer

更多 Apex 基元类型: http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_primitives.htm

关于java - 保存错误 : Invalid type: int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17111383/

相关文章:

java - 数据绑定(bind)列表中的新泛型导致编译错误

java - 在 Wildfly 10 上使用 ActiveMQ Artemis 的 Websockets/STOMP 无法正常工作

java - 将负 Integer.MIN 转换为正 long

java - 跳过第一个数字,从文件 java 中读取 int

java - 如何对泛型类型列表进行 instanceof 检查?

java - 您在复杂的构建过程中使用什么?

algorithm - 圆浮点向量到整数向量

在字符串中遇到换行符时,Javascript 在 Visual Force 页面上不起作用

asp.net-mvc - .NET MVC 和 SalesForce 下拉列表问题

class - 为什么我无法保存此 SalesForce Batchable 类?