java - error: incompatible types: unexpected return value -


this question has answer here:

class fibo{

public static void main(string[] args){     int a=0 ,b=1,c=1 ;     for(int i=0; i<=4; i++){          c=a+b ;         c=a ;         a=b;     }     return c ;    } 

}

when compile program error:

incompatible types: unexpected return value

what mean?

you cannot return main method; it's return type void

you can make static method return type of int if want specfic use-case work


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

Command prompt result in label. Python 2.7 -