Is it necessary to use hasNext() methods in Java before accepting any value from user? Please give a brief and clear answer...
Answers & Comments
x2theGOAT
If you use the scanner class, then yes, you have to use the nextData_type(); Except for char for which you use nextLine(); And for String, you use next(); If you use the buffer reader or any other input commands then next()is not a requirement. Hope this helped.
Answers & Comments
Except for char for which you use nextLine();
And for String, you use next();
If you use the buffer reader or any other input commands then next()is not a requirement.
Hope this helped.