Why scanner is used in java