Program:-
class Employee{
int id;
String name;
int salary;
public void printDetails(){
System.out.println("My id is " + id);
System.out.println("and my name is " + name);
}
public int getSalary(){
return salary;
}
}
public class WritingCustomClassV38 {
public static void main(String[] args) {
System.out.println("This is a custom class");
Employee harry = new Employee();//Initializing a new Employee object.
Employee john = new Employee();//Initializing a new Employee object.
//Setting Attributes.
harry.id = 12;
harry.salary = 150000;
harry.name = "Harry";
//Printing the Attribute.
harry.printDetails();
int salary = harry.getSalary();
System.out.println("My salary is "+salary + "\n");
//Setting Attributes.
john.id = 17;
john.salary = 180000;
john.name = "John";
//Printing the Attribute.\
john.printDetails();
int salary1 = john.getSalary();
System.out.println("My salary is "+salary1);
/* Printing the Attribute.
System.out.println(harry.id);
System.out.println(harry.name); */
}
}

