Wednesday, 1 October 2014

JAVA PROGRAM TO READ A DOUBLE VALUE

program:


import java.io.*;
public class ReadDouble {
public static void main( String[ ] args ) {
try
{
BufferedReader kbd = new BufferedReader(
new InputStreamReader( System.in ) );
System.out.print( "Enter a double: " );
String dblStr = kbd.readLine( );

Double dblObj = Double.valueOf( dblStr );
double number = dblObj.doubleValue( );
System.out.println( "The number is " + number );
}
catch ( IOException ioe )
{
// do something
}
}
}


________________________________________________________________

No comments:

Post a Comment

Total Pageviews