What one of the following is best practice to handle Null Pointer exception?<br>i) int noOfStudents = line.listStudents().count;<br>ii) int noOfStudents = getCountOfStudents(line);<br><pre><code class="java">public int getCountOfStudents(List line){if(line != null) {if(line.listOfStudents() != null) { return line.listOfStudents().size();}}throw new NullPointerException("List is empty");}</code></pre>

Correct Answer: Option (ii)