I wrote a code about result for operator input taken by user and please explain me how this character input work because when i was using
char operation = s.nextLine().charAt(0);
instead of
char operation = s.next().charAt(0);
Eclipse showed Error.
Code -
    System.out.println("Enter First Number:");
    int a = s.nextInt();
    System.out.println("Enter Second Number:");
    int b = s.nextInt();
    System.out.println("Which Operation you want to execute?");
    s.hasNextLine();
    char operation = s.next().charAt(0);    
    int result = 0;
    switch (operation) {
    case '+' :
        result = a + b;
        break;
    case '-' :
        result = a - b;
        break;
    case '*' :
        result = a * b; 
        break;
    case '/' :
        result = a / b;
        break;
    case '%' :
        result = a % b;
        break;
    default:
        System.out.println("Invalid Operator!");
    }
    System.out.println(result);
    s.close();
}
}
 
     
    