Friday, February 27, 2009

I/O in Java

To read Float from command line:

import java.util.Scanner;
Scanner s=new Scanner(System.in);
float f=s.nextFloat();

Scanner: To scan the text
System.in: To receive data from standard input stream

No comments: