java - error: incompatible types: unexpected return value -
this question has answer here:
- incompatible return type error java 5 answers
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
Post a Comment