Home > categories > Consumer Electronics > Keyboards > In Java does the scanner class have an object called keyboard and if yes what does it do?
Question:

In Java does the scanner class have an object called keyboard and if yes what does it do?

if it does not what is keyboard hereint NumberRead keyboard .nextInt();What is keyboard, why has it been used?

Answer:

if keyboard were a Scanner object then it will have been created with the following line: Scanner keyboard; or Scanner keyboard new Scanner(System.in); This line builds the variable keyboard to be an object using the Scanner class. The keyboard object can now call any of the Scanner methods as described in the documentation in the form keyboard.method() Have fun.

Share to: