title: how to call overloaded method in java?
body: <p>I am having trouble trying to call the methods "displayInformation" in main:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class overload
  {
          public static void main (String[ ] args )
          {
           Scanner keyboard = new Scanner(System.in);
           int task;
              System.out.println("Select task 1-3: ");
              task=keyboard.nextInt();
              if (task==1)
              {
              OverloadedMethod o= new OverloadedMethod();
              System.out.println( o.displayInformation(int,int) );
              }
              else if (task==2)
              {
              OverloadedMethod oo= new OverloadedMethod();
              System.out.println( oo.displayInformation(String, int ) ); 
              }
              else if (task==3)
              {
              OverloadedMethod ooo= new OverloadedMethod();
              System.out.println( ooo.displayinformation(String,String) );     
              }
  
          }
  }
  
  
  class OverloadedMethod
  {
  
       public void displayInformation (int num1, int num2)
       {
              Scanner keyboard = new Scanner(System.in);
                  System.out.print("Please enter your first int value: ");
             num1=keyboard.nextInt();
                System.out.print("Please enter your second int value: ");
                num2=keyboard.nextInt();
  
                System.out.print("Values entered: " + num1 + " and " + num2);
  
       }
  
       public void displayInformation (String str, int num)
       {
              Scanner keyboard = new Scanner(System.in);
                  System.out.print("Please enter your first string value: ");
             str=keyboard.nextLine();
                System.out.print("Please enter your second int value: ");
                num=keyboard.nextInt();
  
                System.out.print("Values entered: " + str + " and " + num);
       }
  
        public void displayInformation(String str1, String str2)
        {
                  Scanner keyboard = new Scanner(System.in);
                  System.out.print("Please enter your first string value: ");
             str1=keyboard.nextLine();
                System.out.print("Please enter your second string value: ");
                str2=keyboard.nextLine();
  
                System.out.print("Values entered: " + str1 + " and " + str2);
        }
  }
  </code></pre>
  
  <p>In the program. I ask the user to choose a task, and each task calls a different "displayInformation" method to ask for either an int&amp;int or int&amp;string or string&amp;string. I am having trouble calling the methods in main though, I keep getting the error "error: '.class' expected" for the lines where I create the object..I get errors only for varibales o and oo but not ooo. Why is this?</p>