Last active
August 4, 2020 11:58
-
-
Save AakashCode12/befe8493dfdfe65466e3e4ff849acec6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Employee { | |
int empid; | |
String name; | |
float salary; | |
public void getInput() { | |
Scanner in = new Scanner(System.in); | |
System.out.print("Enter the empid :"); | |
empid = in.nextInt(); | |
System.out.print("Enter the name : "); | |
name = in.next(); | |
System.out.print("Enter the salary : "); | |
salary = in.nextFloat(); | |
System.out.println(); | |
} | |
public void display() { | |
System.out.println("Employee id = " + empid); | |
System.out.println("Employee name = " + name); | |
System.out.println("Employee salary = " + salary); | |
} | |
public static void main(String[] args) { | |
Employee e[] = new Employee[2]; | |
for(int i=0; i<2; i++) { | |
e[i] = new Employee(); | |
e[i].getInput(); | |
} | |
System.out.println("Data Entered as below"); | |
for(int i=0; i<2; i++) { | |
e[i].display(); | |
} | |
} | |
} | |
//C:\Program Files\Java\jdk-14.0.1\bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment