/* Java program for taking input from users */
import java.util.*;
/* Above st. is equivalent to #include in 'C' & 'C++'
And this is taken for Scanner class bcoz its defination
is in that class. */
class input
{
public static void main(String args[])
{
Scanner input_object=new Scanner(System.in);
//we created a obj of class Scanner to take inputs
System.out.println("Enter a integer number:");
int i=input_obj.nextInt();
System.out.println("Enter a float number:");
float f=input_obj.nextFloat();
System.out.println("Enter a string:");
String s=input_obj.next();
System.out.println("Entered data:");
System.out.println("Integer :\t"+i);
System.out.println("Float :\t"+f);
System.out.println("String :\t"+s);
}
}
WHAT'S NEW?
Loading...
0 comments:
Post a Comment