Tuesday, September 6, 2011

SCANNER USAGE

import java.util.*;
class Sam
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
System.out.println("enter name");

String name=s.nextLine();

System.out.println("Enter Age");

int age=s.nextInt();

System.out.println("Enter Salary");

float f=s.nextFloat();

System.out.println("Gender");
String cc=s.next();

char c=cc.charAt(0);

System.out.println(name);
System.out.println(age);
System.out.println(f);
System.out.println(c);

}
}

If U LIKE THE POST FOLLOW THE BLOG

No comments:

Post a Comment