Free web development scripts for the webmasterDevelopment Scripts

 Site Navigation
 o Development Scripts
 o Text Only Edition
 o PHP.net News
 o Tutorials
 o Register an account
 o New entries this week
 o Affiliates/Links
 o Contact Us
 o About us
 o Advanced Search

 Browse Path
 o 4 users online
 o Most users online: 67
 o Home
  o JSP/Java
   o Miscellaneous
    o Script

 Member Login
User Name
Password

 Standards
Valid XHTML 1.0!
Valid 
CSS!

 Recommended Links
 o PHP Freaks
 o Designer Baby Clothes
 o Advertise Here Make Money
 o Wedding Vendor Directory
 o OxyScripts
 o Open Source Design
 o devnet
 o Free Wedding Websites
 o designplace

Read an Integer in from the Keyboard (Rated 0)

Description:

This little code snippet is very useful to demonstrate how you could read a string in as an integer so that you can perform mathmatical analysis on it.

Code starts here


class X {
public static void main(String argv[]) throws IOException {
DataInputStream in=new DataInputStream(System.in);

System.out.println("Enter your name");
String name = in.readLine();

System.out.println("Enter your age");
int age = Integer.parseInt(in.readLine());

System.out.println(name + " you are " + age + " years old.");
}
}


Submitted by Devscripts on 24-02-2003 12:10


Rate This Script

User Contributed Comments

Registered Members login
© Copyright 2003 - Devscripts.net