Employee Details using input as keyboard

public class scannerexp {

public static void main(String[] args) {


System.out.println("Enter employee details:");
Scanner sc=new Scanner(System.in);

String name=sc.next();
int age=sc.nextInt();
float salary=sc.nextFloat();

System.out.println("Name="+name);
System.out.println("Age="+age);
System.out.println("Salary="+salary);

}

}

Output:

Enter employee details:john 28 50000


Name=john
Age=28

Salary=50000.0


No comments:

Post a Comment