I am writing a method which will return if something is true or not. But if the resources needed to test the condition are not available, it will not be able to return true or false.
Earlier, I was just making it a method which returns a boolean. But now, to accommodate exceptions, I am thinking of passing true or false in function arguments and using the return value as success or failure indicator for the test.
Is this the “correct and common” way of doing it in Java? Or is something else prevalent in Java to achieve this?
Your method should return a boolean and throw an Exception if resources are unavailable.