Thursday, 12 February 2015

Sample Applications on Objects Creation


public class Employee {
    int eid;
    double sal;
    void  insertDetails(int eid, double sal)
    {
        this.eid=eid;
        this.sal=sal;
       
    }
    void display()
   
    {
        System.out.println(eid);
        System.out.println(sal);
    }
   
    public static void main(String[] args) {
       
        Employee e1=new Employee();
        Employee e2=new Employee();
        e1.insertDetails(121,12000.00);
        e2.insertDetails(122,12500.00);
        e1.display();
        e2.display();
       
       
    }

}

No comments:

Post a Comment