I have a feeling the answer is “no” but thought I’d ask just in case…
pseudo code:
Foo foo = new Foo();
if(foo != null){
foo.useMe();
}else{
System.out.println("foo failed to initialize");
}
What would I have to do in Foo to make this a reality?
Typically you would just have it throw an exception for this situation. You can easily write your own exception or just use something like
throw new Exception("foo failed to initialize");and capture that.Writing your own Exception: http://www.javaplex.com/blog/java-creating-custom-exceptions/