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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -