Computer Science, asked by rakshit8732, 7 hours ago

Distinguish between the following:
(i) next () and NextLine()
(ii) next () and next(). CharAt (0) (iii) next() and hasNext ()
(iv) has Next () and has Nextline () ​

Answers

Answered by Pratishtha55
2

Answer:

(I). next() can read the input only till the space. It can't read two words separated by a space. Also, next() places the cursor in the same line after reading the input.

next() can read the input only till the space. It can't read two words separated by a space. Also, next() places the cursor in the same line after reading the input.nextLine() reads input including space between the words (that is, it reads till the end of line \n). Once the input is read, nextLine() positions the cursor in the next line.

next() can read the input only till the space. It can't read two words separated by a space. Also, next() places the cursor in the same line after reading the input.nextLine() reads input including space between the words (that is, it reads till the end of line \n). Once the input is read, nextLine() positions the cursor in the next line.For reading the entire line you can use nextLine().

(ii). Sorry I don't know..

(iii). hasNext() : hasNext() method returns true if iterator have more elements. next() : next() method returns the next element and also moves cursor pointer to the next element. hasNext() - Returns true if the iteration has more elements.

(iv). next() can read the input only till the space. It can't read two words separated by a space. Also, next() places the cursor in the same line after reading the input. nextLine() reads input including space between the words (that is, it reads till the end of line \n ).

here is your answer

hope it helps you

pls mark me Brainliest answer

Similar questions