title: What is a stack trace, and how can I use it to debug my application errors?
body: <p>Sometimes when I run my application it gives me an error that looks like:</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
          at com.example.myproject.Book.getTitle(Book.java:16)
          at com.example.myproject.Author.getBookTitles(Author.java:25)
          at com.example.myproject.Bootstrap.main(Bootstrap.java:14)
  </code></pre>
  
  <p>People have referred to this as a "stack trace". <strong>What is a stack trace?</strong> What can it tell me about the error that's happening in my program?</p>
  
  <hr/>
  
  <p><em>About this question - quite often I see a question come through where a novice programmer is "getting an error", and they simply paste their stack trace and some random block of code without understanding what the stack trace is or how they can use it. This question is intended as a reference for novice programmers who might need help understanding the value of a stack trace.</em></p>