title: Difference between next( ) and next( ).CharAt(0);
body: <p>I have created an abstract class Employee which displays and calculates the Details of Weekly and Hourly Employee.In the main method i have used switch case for a menu and do while to continue using the program as long as the user want.But I'm getting an Error when compiling the code.:</p>
  
  <pre><code>*javac "AbstractDemo.java" (in directory: /home/user/Desktop)
  AbstractDemo.java:52: error: incompatible types
      ch=s.next();
               ^
    required: char
    found:    String
  1 error
  Compilation failed.*
  </code></pre>
  
  <p>This is the Source Code:</p>
  
  <pre><code>import java.util.*;
  abstract class Employee{
      Employee(float amt,int n){
          float sal;
          System.out.println("The amount paid to Employee is:"+amt);
          sal=amt*n;
          System.out.println("Total Salary is:"+sal);
      }
  
  } 
  class WeeklyEmployee extends Employee{
          WeeklyEmployee(float a,int n){
          super(a,n);
      }
  }
  class HourlyEmployee extends Employee{
          HourlyEmployee(float amt,int hrs){
          super(amt,hrs);
      }
  }           
  
  public class AbstractDemo {
  
      public static void main (String args[]) {
          int a;
          char ch;
          float amount;
          int hours;
          int weeks;
          Scanner s=new Scanner(System.in);
          do{
  
          System.out.println("Enter the choice");
          a=s.nextInt();
          switch (a) {
              case 1 :
          System.out.println("Enter the salary of weekly employee(Per Week):");
          amount=s.nextFloat();
          System.out.println("Enter the total no of week");
          weeks=s.nextInt();
               Employee W=new WeeklyEmployee(amount,weeks);break;
               case 2:
  
          System.out.println("Enter the salary of hourly employee(Per hour):");
          amount=s.nextFloat();
          System.out.println("Enter the total no of hours");
          hours=s.nextInt();
          Employee H=new HourlyEmployee(amount,hours);break;
              default:System.out.println("Error invalid Choice");
      }
      System.out.println("Do you wish to continue?(Y/N)");
      ch=s.next();
  }while (ch== 'y'||ch== 'Y');
  
  }
  }
  </code></pre>
  
  <p>But When i use <code>s.next().ChatAt(0);</code> the code compiles successfully.Could somebody explain why this is happening?Is Char taking input as String?Or if it is a string why its showing an Error when i edit the while condition to <code>while(ch=="y"||ch=="Y");</code> ?</p>