gudii9
asked on
method reurn
Hi,
public int sortaSum(int a, int b) {
int c;
c=a+b;
if((c>=10&&c<=19)){
return 20;
}
else{
return c=a+b;
}
}
How above is valid where as below is not valid. please advise
public int sortaSum(int a, int b) {
int c;
c=a+b;
if((c>=10&&c<=19)){
return 20;
}
else
//{
// return c=a+b;
//}
}
P
public int sortaSum(int a, int b) {
int c;
c=a+b;
if((c>=10&&c<=19)){
return 20;
}
else{
return c=a+b;
}
}
How above is valid where as below is not valid. please advise
public int sortaSum(int a, int b) {
int c;
c=a+b;
if((c>=10&&c<=19)){
return 20;
}
else
//{
// return c=a+b;
//}
}
P
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
method is declared to return int and it is possible for the method to end without returning anything
i think this is missing gap in my understanding
Is the gap now filled?
ASKER
yes. i filled now. thank you.
by the way, not able to understand exact question except validation of syntax.