title: Defensive programming and exception handling
body: <p>A couple days ago, I have following theoretical questions on the exam:
  (a) Explain what is meant by defensive programming when dealing with
     exceptional circumstances that may occur during the execution of a
    program. You may refer to examples seen in class or use pseudo
   code to describe the steps taken to prevent certain circumstances
  from occurring when trying to read a file for example.
  [5 marks]<br><br>
  (b) Briefly describe in general terms what is meant by exception handling
     in Java and how this differs from defensive programming.
    [5 marks]</p>
  
  <p>I always thought that defensive programming is the whole paradigm of programming and that exception handling is the part of it.
  During exam I write that in "defensive programming", programmer try to find out all possible problems before executing the logic code, and later on return error value(example 0) from this function, whereas in exception handling the potential errors occurs and are caught by special mechanism, in which these errors are directly being interpreted. Is it right? What should be correct answers?</p>