Created
November 9, 2015 09:00
-
-
Save ornirus/70bd10e5d90af5b7b0c4 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.LinkedList; | |
import java.util.List; | |
public class Employee { | |
private String name, designation; | |
private int age; | |
private double salary; | |
public static void main(String [ ] args) { | |
List<Employee> employees = new LinkedList<Employee>(); | |
employees.add(new Employee("Alex", "Student", 17, 0)); | |
for (Employee e : employees) { | |
System.out.println(e); | |
} | |
} | |
public Employee(String n, String d, int a, double s) { | |
name = n; | |
designation = d; | |
age = a; | |
salary = s; | |
} | |
public String getName() { | |
return name; | |
} | |
public void setName(String n) { | |
name = n; | |
} | |
public String getDesignation() { | |
return designation; | |
} | |
public void setDesignation(String d) { | |
designation = d; | |
} | |
public int getAge() { | |
return age; | |
} | |
public void setAge(int a) { | |
age = a; | |
} | |
public double getSalary() { | |
return salary; | |
} | |
public void setName(double s) { | |
salary = s; | |
} | |
public String toString() { | |
return name + " " + age + " " + designation + " " + salary; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment