title: Java- How do I gather classes by using enum?
body: <p>Let's assume that I have lots of implementations of matrices (Which don't extend from one to another) and I want the user to be able to see all the different classes, to gather them in some kind of enum or something, How can I do that?
  It doesn't have to be a menu or something, just so I will be able to see all the classes, just like enum.</p>
  
  <p>For example:</p>
  
  <pre><code>MainMatrix matrix= new (ALL THE POSSIBILITIES)();
  </code></pre>
  
  <p>While the MainMatrix is the common interface of all matrices.</p>
  
  <p>Can I use enum that will create instance of new class matching the option I'll choose? 
  for example:</p>
  
  <pre><code>public enum Matrices{
  DIAGONAL_MATRIX(new DiagonalMatrix());
  ..
  ..
  }
  </code></pre>
  
  <p>Can I do that? </p>