im having problems with my input. i want the output to look like this
Enter first string:
first <- user input
Enter second string:
second <- user input
The contents are first and second
but the output doesnt look like that and the input is messed up. what seems to be the problem?
import java.util.*;
class Sample
{
public static void main(String[]args)
{
Scanner input=new Scanner(System.in);
String a,b;
System.out.println("Enter first string: ");
a=input.nextLine();
System.out.println("Enter second string: ");
b=input.nextLine();
System.out.println("The contents are "+a+" and "+b+" ");
}
}