in Education by
Why in.nextLine() and in.next() is used in scanner class Plz answer in points Select the correct answer from above options

1 Answer

0 votes
by
in.nexLine() is used to accept the entire String sentence avialable to the scanner object, before a line break, and stored in the string variable. in.next() however accepts only the next token….i.e. only the word avialable( the characters avialable to thr scanner object in before a delimiter(by default a whitespace and linebreak are delimiters for scanner class)occurs). Consider this example:- If you Enter: Hi I amRahul using:str = in.nextLine(); the entire sentence is stored in str. using:str1= in.next();only the first word (here Hi) enters into str1. Therefore, Output: str= Hi I am Rahul str1= Hi

Related questions

0 votes
    What are the wrapper classes ? What is the difference between scanner class and wrapper class ? 100 points . Select the correct answer from above options...
asked Dec 28, 2021 in Education by JackTerrance
0 votes
    Using Scanner, input name, class, div, roll number and marks in three subjects of a student. Calculate total ... total and average. Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
0 votes
    Fill in the Blanks. (5) A. is a type of scanner that is used to capture the highest resolution from an image. Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    conclusion on hardware like LCD projector,scanner,printer,digital camera,camcorder and software like word processor,spreadsheet ppt Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    12. 14″, 17″, 19″ and 21″ are the dimension of (b) VDU (d) (a) Printer (c) Scanner id) Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    write a java program to print areaof an equilateral triangle . (without using scanner) Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    which of the following is a component of a software (a) scanner (b) keyboard (c) printer (d) instruction Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    2.THERE ARE 2 RESTAURANTS NEXT TO EACH OTHER. ONE HAS A SIGN THAT SAYS GOOD FOOD IS NOT CHEAP AND ... THEY ARE LOGICALLY EQUIVALENT. Select the correct answer from above options...
asked Dec 28, 2021 in Education by JackTerrance
0 votes
    difference between Next( )and NextInt( ) fast plz… 2 points. only. Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    name the tool bar present next to the file tab by default which button or present on this tool bar Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    what is the purpose of the step statement in a FOR..NEXT Loop? Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
...