12.07.2015 Views

5 Getting Input from Keyboard

5 Getting Input from Keyboard

5 Getting Input from Keyboard

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Steps to get <strong>Input</strong>3. Declare a temporary String variable to get the input, andinvoke the readLine() method to get input <strong>from</strong> thekeyboard. You have to type it inside a try-catch block.try{String temp = dataIn.readLine();}catch( IOException e ){System.out.println(“Error in getting input”);}Introduction to Programming 1 6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!