Skip to content

Instantly share code, notes, and snippets.

@ornirus
Created November 9, 2015 09:00
Show Gist options
  • Save ornirus/70bd10e5d90af5b7b0c4 to your computer and use it in GitHub Desktop.
Save ornirus/70bd10e5d90af5b7b0c4 to your computer and use it in GitHub Desktop.
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