I am using scanner to get input of a String.My code is as below
String s=scan.next();
if(scan.hasNext()){
s +=scan.nextLine();
}
But the problem is it is not reading the white spaces in the beginning.
Example
Input : Hello World
Output should be : Hello World
Output is :Hello World
Please clarify what is the mistake and help me rectify.