Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Kenneth Bennett   on Oct 18 In Java Category.

  
Question Answered By: Katrina Edwards   on Oct 18

The return(null) statement  has to be included since
the compiler has to be sure that the method  returns
_some_ object.
In case your method throws an exception, the return
Class.forName... is not executed and the callee gets
unexpected behaviour (if the 2nd return  statement is
not there). To prevent this, your method has to have a
foolproof return statement which will be executed no
matter what.
Incidentally, if you remove the return(null)
statement, the compiler gives an error.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on missing RETURN statements Or get search suggestion and latest updates.


Tagged: