簡體   English   中英

為什么我收到錯誤“類型不匹配”?

[英]Why i am getting error “Type Mismatch”?

當我嘗試在主類中初始化構造函數時,出現錯誤類型不匹配的情況。

public class Test_array 
{
    int arr[];
     Test_array()
      {
          arr=new arr[];     
      }


  public static void main(String[]args)
  {

  }
}

class RecTest 
{
int values[];
RecTest() 
{
values = new int[10];
}

}

arr是變量名而不是類型

arr = new int[10];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM