Code:
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner S=new Scanner(System.in); System.out.println("Enter the first integer "); int i=S.nextInt(); System.out.println("Enter the second integer "); int j=S.nextInt(); System.out.println("Enter the first character "); char ch1=S.next().charAt(0); System.out.println("Enter the second character "); char ch2=S.next().charAt(0); System.out.println("Enter the first string "); String str1=S.nextLine(); System.out.println("Enter the second string"); String str2=S.nextLine(); OverloadCompare object=new OverloadCompare(); object.Compare(i, j); object.Compare(ch1, ch2); object.Compare(str1, str2); S.close(); } }

When I execute the program, it asks for first, second integers and characters, but the first string asking is not asked, its just printed but I don't get to input it, only the second string can be inputed. Whats wrong ??