2017-09-13 65 views
1

我收到以下错误在我的计划:错误程序的合数

int值不会解除引用

有人能帮忙吗?

public void fill() { 
    int b; 

    for (b = 0; b < 400; b++) { 
     if (b.isComposite() == true) { //Error-int is not dereferenced 
      for (int i = 0; i < m; i++) { 
       for (int j = 0; j < n; j++) { 
        arr[j][i] = b; 
       } 
      } 
     } 
    } 
} 

回答

1

您不能将.isComposite()应用于整数,因为它只能应用于对象。试试这个.....

for(int b = 0; b < 400; b++) { 
     if (isComposite(b)) { 
      //your other code 
     } 
}