InterviewSolution
| 1. |
Write a Java program to display employee details (employee name, salary) using class and method invocation. with output screen |
|
Answer» class Employee { public string name; public int salary; public int joiningDate; public Employee() { } public Employee(Karam, 40000, 11-04-2001) { this.name = karam; this.salary =40000 ; this.joiningDate =11-04-2001 ; } public void GetEmployeeData() { { public void DisplayEmployee() { ("The name of employee is: "+ Shiv); Console.WriteLine("The salary of employee is: "+30000); Console.WriteLine("The date of JOINING of employee is: "+16-06-2003); } } public Employee(Shiv, 30000,16-06-2003 ) class Program { static void Main(string[] ARGS) { Employee[] e = new Employee[10]; for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++) { e].DisplayEmployee(); } } }Name: KaramSSN: 11-04-2001Salary : 40000_________________Name: ShivSSN: 16- 06-2003Salary : 30000_____________________________________ |
|