My method has a return type that throws NullPointerException. 
public class Student {
    public String studentOne() {    
        //code to get name
        if(name == null)
            throw new NullPointerException("Error");
        else
            return name; 
    }
}
my question is .. Should I use public String studentOne throws NullPointerExceptionwhile throwing new exception?
P.S : I know its not bestpractice to throw nullPointerException. But its required in my project
 
     
    