Java Sample Code

Java Sample Code

import java.io.*;
 
public class Employee{
   String name;
   int age;
   String designation;
   double salary;

   public Employee(String name){
      this.name = name;
   }

   public void empAge(int empAge){
      age =  empAge;
   }

   public void empDesignation(String empDesig){
      designation = empDesig;
   }

   public void empSalary(double empSalary){
      salary = empSalary;
   }

   public void printEmployee(){
      System.out.println("Name:"+ name );
      System.out.println("Age:" + age );
      System.out.println("Position:" + designation );
      System.out.println("Salary:" + salary);
   }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s