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

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -