Chapter2_4-InputOutput

A touir introduction to oop example 1 import

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ata • int x = read.nextInt(); Page 4 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Example 1 import Java.util.Scanner; 2 Scanner input ; // declaring the reference variable of a Scanner 3 int area ,length, width; // declaring variables to store entries 4 input = new Scanner (System.in); // creating an instance 5 length = input.nextInt(); //reading the length from the keyboard 6 width = input.nextInt(); //reading the width from the keyboard 7 area = length * width ; // computing the area // displaying the result 8 System.out.println(“the legnth is ...
View Full Document

This document was uploaded on 03/03/2014.

Ask a homework question - tutors are online