title: the method ... is not defined for the Type whem trying to create a new object
body: <p>I'm using an ArrayList to record several newly created Person objects. My problem is that when I call the constructor  to instantiate a Person object, Java won't recognize that method (the constructor). I get an error message saying <code>the method Person(String, int) is not defined for the Type DemoList</code> Why doesn't Java realize I am trying to create another object here?</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Scanner;
  
  public class DemoList {
      //input from keyboard
          static Scanner reader = new Scanner(System.in);
          static ArrayList&lt;Person&gt; array = new ArrayList&lt;Person&gt;();
  
      public static void main(String[] args)
      {
          System.out.println("To quit, press 0, to continue, press 1 \n");
          int in = 1;
  
  
          while(in !=0)
          {
              System.out.println("Please enter a name: ");
              String name = reader.nextLine();
              System.out.println("Please enter a telephone number");
              int number = reader.nextInt();
              Person newPerson = Person(name, number);
              array.add(newPerson);
              System.out.println("Press 1 to continue or 0 to quit");
              in = reader.nextInt();
          }
  
          //The user typed 0
  
  
          System.out.println("Who would you like to delete? ");
          String name = reader.nextLine();
          for(int i = 0; i &lt; array.size(); i++)
          {
              Person searchPerson = array.get(i);
              if(searchPerson.name == name)
              {
                  array.remove(i);
                  break;
              }
          }
          PrintArray();
  
      }
  
      public static void PrintArray()
      {
          System.out.println("-------------------------------");
  
          //scroll through each item in array and put it in variable i
              for(Person i : array)
              {
                  System.out.println(i);
              }
      }
  
  }
  
  class Person
  {
      protected String name;
      protected int number;
  
      public Person(String name, int number)
      {
          System.out.println("Person object created! \n");
          this.name = name;
          this.number = number;
  
      }
  }
  </code></pre>