title: Compilation problem when working with java.util.Map
body: <p>I am trying to compile this program. It works perfectly for 2 Strings(Name, phone number) But not for 3 Strings (Name, phone number and sex).</p>
  
  <hr>
  
  <p><strong>CODE</strong> (<em>Not working code - 3 Strings (Name, phone number and sex)</em>)</p>
  
  <hr>
  
  <pre><code>import java.util.Map;
  import java.util.TreeMap;
  
  public class Ann {
  
  String name, phone;
  
  public Ann() {
  }
  
  public static void testMap() {
      Map&lt;String, String, String&gt; theMap = new TreeMap&lt;String, String,String&gt;();
      // new HashMap&lt;K,V&gt;(); could also be used
      theMap.put("Roger M", "090-997-2918", "Male");
      theMap.put("Jane M", "090-997-1987", "FeMale");
      theMap.put("Stacy K", "090-997-9188", "FeMale");
      theMap.put("Gary G", "201-119-8765", "Male");
      theMap.put("Jane M", "090-233-0000", "FeMale");
      System.out.println("Testing TreeMap and Map");
      System.out.print("Stacy K has phone ");
      System.out.print(theMap.get("Stacy K"));
      System.out.print("\n");
  
      System.out.print("Jane M has phone ");
      System.out.print(theMap.get("Jane M"));
  } // testMap()
  
  public static void main(String[] args) {
      testMap();
  
  }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>ERROR</strong></p>
  
  <pre><code>wrong number of type arguments; required 2
  
  wrong number of type arguments; required 2
  </code></pre>
  
  <hr>
  
  <hr>
  
  <p><strong>WORKING CODE</strong> (<em>For 2 Strings (Name, phonenumber)</em>)</p>
  
  <hr>
  
  <pre><code>import java.util.Map;
  import java.util.TreeMap;
  
  public class Ann {
  
  String name, phone;
  
  public Ann() {
  }
  
  public static void testMap() {
      Map&lt;String, String&gt; theMap = new TreeMap&lt;String, String&gt;();
      // new HashMap&lt;K,V&gt;(); could also be used
      theMap.put("Roger M", "090-997-2918");
      theMap.put("Jane M", "090-997-1987");
      theMap.put("Stacy K", "090-997-9188");
      theMap.put("Gary G", "201-119-8765");
      theMap.put("Jane M", "090-233-0000");
      System.out.println("Testing TreeMap and Map");
      System.out.print("Stacy K has phone ");
      System.out.print(theMap.get("Stacy K"));
      System.out.print("\n");
  
      System.out.print("Jane M has phone ");
      System.out.print(theMap.get("Jane M"));
      } // testMap()
  
  public static void main(String[] args) {
      testMap();
  
  }
  }
  </code></pre>
  
  <hr>
  
  <p>I want the code to work for about 5 attributes like name , phone, sex,age,address. If someone can help me compile the code at the top of the question, I can figure out the rest.</p>
  
  <p>Thanks</p>