0

Return statement in java

What does return 0... return 1... and return -1.. do... I google it but find no satisfatory answer.. plis

9/7/2019 6:11:48 AM

stephen haokip

1 Answer

New Answer

+2

Totally depend on function/program logic. For e.g if you compare two string then return 0 means two strings are equal. -1 mean string1 is smaller than string2 or other way round. 1 means string1 is bigger than string2 or other way round. In some other program it can mean totally different thing.