title: Taking user input for the objects
body: <p>Question : Create a two objects of class Employee and check both are same or diffrent</p>
  <p>Below code gives an error : <strong>Exception in thread &quot;main&quot; java.util.InputMismatchException</strong></p>
  <p><strong>Only object e1 accepts values</strong></p>
  <pre><code> class Employee {
          String name;
          int age;
          char gender;
  
          public Employee() {
                  super();
          }
          public Employee (String name, int age, char gender) {
              this.gender = gender;
              this.name = name;
              this.age = age;
          }
          public String getName() {
              return name;
          }
          public void setName(String name) {
              this.name = name;
          }
          public int getAge() {
              return age;
          }
          public void setAge(int age) {
              this.age = age;
          }
          public char getGender() {
              return gender;
          }
          public void setGender(char gender) {
              this.gender = gender;
          }
  }
  public class Source {
          public static void main(String[] args) {
              Scanner sc = new Scanner(System.in);
              Employee e1 = new Employee();
      
              //e1.name = sc.nextLine();
              //e1.age = sc.nextInt();
              //e1.gender = sc.next().charAt(0);
              System.out.println(e1.name+&quot; &quot;+e1.age+&quot; &quot;+e1.gender);
              Employee e2 = new Employee();
              //e2.name = sc.nextLine();
              //e2.age = sc.nextInt();
              //e2.gender = sc.next().charAt(0);
              System.out.println(e2.name+&quot; &quot;+e2.age+&quot; &quot;+e2.gender);
      
              boolean isSame = e1.equals(e2);
              if(e1.equals(e2)) {
                  System.out.println(&quot;Same&quot;);
              }
              else {
                  System.out.println(&quot;Different&quot;);
              }
         }
  }
  </code></pre>
  <p>How to take user input or input from keyboard for objects e1 and e2?</p>