title: Can anyone help me understand what is wrong with this code from my Java class
body: <p>I keep getting the same error which makes no sense to me.</p>
  <pre class="lang-none prettyprint-override"><code>Exercise03_01.java:5: error: class Exercise_03_01 is public, should be declared in a file named Exercise_03_01.java
  public class Exercise_03_01 {
  </code></pre>
  <p>Heres my code:</p>
  <pre><code>import java.util.Scanner;
  
  public class Exercise_03_01 {
      public static void main(String[] args) {
      
          Scanner input = new Scanner(System.in);
  
      
          System.out.print(&quot;Enter a, b and c: &quot;);
          // Prompt for user to enter the inputs
          
          double a = input.nextDouble();
          double b = input.nextDouble();
          double c = input.nextDouble();
  
          // Compute the discriminant of the equation.
          
          double discriminant = Math.pow(b, 2) - 4 * a * c;
  
          System.out.print(&quot;The equation has &quot;);
          if (discriminant &gt; 0)
          {
              double root1 = (-b + Math.pow(discriminant, 2)) / (2 * a);  
              double root2 = (-b - Math.pow(discriminant, 2)) / (2 * a);  
              System.out.println(&quot;two roots &quot; + root1 + &quot; and &quot; + root2);
          }
          else if (discriminant == 0)
          {
              double root1 = (-b + Math.pow(discriminant, 2)) / (2 * a);
              System.out.println(&quot;one root &quot; + root1);
          }
          else
              System.out.println(&quot;no real roots&quot;);
          }
      }
  </code></pre>