Is it ok to use optional everywhere just to get over nullpointerexception ?
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. Is it ok to use optional everywhere just to get over nullpointerexception ?Core Java
Ans. Optional is to be used for arguments / atrributes which are indeed optional i.e the request should continue even if they aren't provided. It should not be used for mandatory attributes or arguments as we would like application to shout out ( with error message / exception trace ) to signify a problem.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     optional  nullpointerexception  java8  java 8     Asked in 1 Companies


Related Questions

  What is the use of Optional ?
  Name few "Optional" classes introduced with Java 8 ?
 How can we make the constructor variables optional in Typescript ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: