title: Error message "java.lang.NoSuchMethodError: Customer.<init>(Ljava/lang/String;D)V "
body: <p>I keep getting the same error message when running this program. This is what i get:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: Customer.&lt;init&gt;(Ljava/lang/String;D)V 
  at Customer5.input(Customer5.java:35)&lt;b&gt;---(See below (code) to refer to lines 35 &amp; 7)
  at Customer5.main(Customer5.java:7)
  </code></pre>
  
  <p>Another thing is that the class "Customer" shows a message that says "The type Customer is already defined." </p>
  
  <pre><code>import java.util.*;
  public class Customer5 {
  
      public static void main(String[] args) {
  
  
          Customer[] customers=input();//This is line 7
          customers=sort(customers);
          output(customers);
      }
  
  
      public static Customer[] input(){
  
          Scanner input =new Scanner(System.in);
          int n;
  
  
          String name;
          double debt;
  
  
          System.out.print("Enter number of customers :");
          n=input.nextInt();
  
          Customer[] customers=new Customer[n];
          for(int i=0; i&lt;n; i++){
  
              System.out.print("Enter name:");
              name=input.next();
  
              System.out.print("Enter debt:");
              debt=input.nextDouble();
  
              customers[i]=new Customer(name, debt);//This is line 35
          }
          return customers;
      }
  
  
      public static Customer[] sort(Customer[] customers){
  
          Customer temp;
          for(int i=0; i&lt;customers.length; i++){
  
               for(int j=i+1; j&lt;customers.length; j++){
  
                     if(customers[j-1].debt&gt;customers[j].debt){
  
                           temp=customers[j-1];
                           customers[j-1]=customers[j];
                           customers[j]=temp;
                     }
               }
          }
                return customers;
      }
  
  
  
       public static void output(Customer[] customers){
              for(int i=0; i&lt;customers.length; i++){
               System.out.println(customers[i].name+"\t" +customers[i].debt);
              }
       }
  
  
  
  } 
  
  class Customer{ //this line shows a message that says:The type Customer is already defined
  
      public String name;
      public Double debt;
  
      public Customer(String name, double debt){
         this.name=name;
         this.debt=debt;
      }
  
  }
  </code></pre>
  
  <p>I don't know what to do in order to fix it. I am not very familiar with this type of error message. I'd really appreciate any feedback or comments on how to approach this problem. Thanks!</p>