day3.22cse110

day3.22cse110 - Chapter 2 Data Input From the last lecture...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 2 Data Input
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
From the last lecture: Data variables Variables are place holders to store data in the program. Values stored in a variable can change during the execution of the program. Developed the program to calculate and display the perimeter and the area of a rectangle if the length and width is known.
Background image of page 2
Interactive Programs Programs generally need input on which to operate The Scanner class provides convenient methods for reading input values of various types A Scanner object can be set up to read input from various sources, including the user typing values on the keyboard Keyboard input is represented by the System.in object
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reading Input The following line creates a Scanner object that reads from the keyboard: Scanner scan = new Scanner (System.in); The new operator creates the Scanner object Once created, the Scanner object can be used to invoke various input methods, such as: answer = scan.nextLine();
Background image of page 4
Reading Input The Scanner class is part of the
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/08/2010 for the course CSE 110 taught by Professor Kim during the Spring '08 term at ASU.

Page1 / 10

day3.22cse110 - Chapter 2 Data Input From the last lecture...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online