title: ClassNotFoundException vs NoClassDefFoundError
body: <p>I have gone through this thread <a href="https://stackoverflow.com/questions/1457863/what-is-the-difference-between-noclassdeffounderror-and-classnotfoundexception">What causes and what are the differences between NoClassDefFoundError and ClassNotFoundException?</a>
  This is what one of the ans,which has max ups,  in thread is :
  <strong>NoClassDefFoundError</strong> :"So, it appears that the NoClassDefFoundError <strong>occurs when the source was successfully compiled, but at runtime, the required class files were not found</strong>. This may be something that can happen in the distribution or production of JAR files, where not all the required class files were included."</p>
  
  <p><strong>ClassNotFoundException</strong> : As for ClassNotFoundException, it appears that it may stem from trying to make reflective calls to classes at runtime, but the classes the program is trying to call is does not exist.</p>
  
  <p>I did a small experiment . I created a main class, <strong>class A</strong> and tried to call other class, class <strong>B</strong> from it , compiled successfully.</p>
  
  <p>Then i deleted the class B which is being called in class A.
  I got the  <strong>java.lang.ClassNotFoundException</strong> but as per the answer in the tread, i should have got NoClassDefFoundError (source was compiled succesfully but at runtime class files were not found)
  Could anyone explain what am i missing in the interpretation of the ans in the thread  ?</p>
  
  <pre><code>package com.random;
  
  public class A {
  
      public static void main(String[] args) {
          B b= new B();
  
      }
  
  }
  
   package com.random;
  
  public class B {
  
  
  
  }
  </code></pre>