1 / 4

INFT11-110/71-110 Keyboard Input

INFT11-110/71-110 Keyboard Input. Class Keyboard provides a way to read each of the primitive types and also Strings from the keyboard: Keyboard.readInt() reads an int Keyboard.readByte() reads a byte Keyboard.readShort() reads a short Keyboard.readLong() reads a long

clive
Download Presentation

INFT11-110/71-110 Keyboard Input

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INFT11-110/71-110Keyboard Input

  2. Class Keyboard provides a way to read each of the primitive types and also Strings from the keyboard: Keyboard.readInt() reads an int Keyboard.readByte() reads a byte Keyboard.readShort() reads a short Keyboard.readLong() reads a long Keyboard.readFloat() reads a float Keyboard.readDouble() reads a double Keyboard.readChar() reads a char Keyboard.readBoolean() reads a boolean Keyboard.readString() reads a String Keyboard is based on the Keyboard class from the textbook. A Class to Read from the Keyboard Reading input from the keyboard (or anywhere, really) is quite complicated in Java We will use a special class, Keyboard, to simplify the process • You don’t need to understand how Keyboard works yet • You do need to be able to follow these instructions to incorporate the class into your programs

  3. Using Keyboard

  4. Making This Happen 1. Download Keyboard.java from the webpage and store it in a central location 2. Make a new project as normal and create a main program such as the one on the previous slide, or the one from the webpages 3. Select “Add Class from File” from the Edit menu of the Project window

More Related