/*************************************** This is a good example of scope in Java. The Output will be: please type in a string This is a simple program the string you typed was **This is a simple program** please type in an integer 13 the integer you typed was 13 ******************************************/ import java.lancs.*; public class GoodExample { public static void main(String[] args) throws Exception { // read in and output a String BasicIo.prompt("please type in a string "); String wordResponse = BasicIo.readString(); System.out.println("the string you typed was **" + wordResponse + "**"); System.out.println(); //read in and output an integer BasicIo.prompt("please type in an integer "); int numResponse = BasicIo.readInteger(); System.out.println("the integer you typed was " + numResponse); } // end of method main } // end of class GoodExample
These pages were edited for style and content by
Allan Caine, Laura Drever, Gorana Jankovic, Megan King, and Marie Lewis.
The original authors of these pages were Graeme Humphries, Chantal Laplante, Chris Mills,
and Melvin Lenz.
Last Modified: Wednesday, June 7th 23:45:30
Copyright 2000 Department of Computer Science, University of
Regina.