static int comparess(int x)
{
if(x==100)
return x;
else
return 200;
}
public static void main(String args[]){
int a=25; //or just anything
int result;
result=comparess(a);
}
I am sorry to be asking a silly question
but i am just a beginner
Can anyone explain me why this gives an error
method must return a int type
like i am still returning an int type even when the else part is executed
Aucun commentaire:
Enregistrer un commentaire