I come from C world, and there we used "defines" to define different return values, values returned from C functions, like so:
#define RETURN_SUCCESS 0
#define RETURN_ERROR -1
int myFunc()
{
if(...) return(RETURN_SUCCESS);
else if(...) return(RETURN_ERROR);
}
How is this done in Java, the right way?
Suppose I have:
public MyObject findMyObject()
{
MyObject tempObject = search();
if( tempObject.type == myType )
{
return tempObject;
}
else
{
return null;
}
}
Is it ok to return null
?
Is there a more proper way of doing it?