Created
November 1, 2015 05:45
-
-
Save rishi93/545f47804442d56e5211 to your computer and use it in GitHub Desktop.
Employee class
This file contains hidden or 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.io.*; | |
class Employee | |
{ | |
private String name; | |
private int salary; | |
public Employee(String name,int salary){ | |
this.salary = salary; | |
this.name = name; | |
} | |
void getname(){ | |
System.out.println(this.name); | |
} | |
void getsalary(){ | |
System.out.println(this.salary); | |
} | |
} | |
public class Main | |
{ | |
public static void main (String[] args) | |
{ | |
Employee e1 = new Employee("John",15000); | |
Employee e2 = new Employee("Tina",20000); | |
e1.getname(); | |
e1.getsalary(); | |
e2.getname(); | |
e2.getsalary(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment