Variable might not have been initialized error

前端 未结 11 1622
孤城傲影
孤城傲影 2020-11-21 05:50

When i try to compile this:

public static Rand searchCount (int[] x) 
{
    int a ; 
    int b ; 

    ...   

    for (int l= 0; l

        
11条回答
  •  面向向阳花
    2020-11-21 06:17

    You declared them, but not initialized.

    int a; // declaration, unknown value
    a = 0; // initialization
    int a = 0; // declaration with initialization
    

提交回复
热议问题