Skip to content

Instantly share code, notes, and snippets.

@rishi93
Created November 1, 2015 05:45
Show Gist options
  • Save rishi93/545f47804442d56e5211 to your computer and use it in GitHub Desktop.
Save rishi93/545f47804442d56e5211 to your computer and use it in GitHub Desktop.
Employee class
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