-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathquick_quiz.java
25 lines (24 loc) · 938 Bytes
/
quick_quiz.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Employee {
// First constructor
Employee(String s, int i){
System.out.println("The name of the first employee is : " + s);
System.out.println("The id of the first employee is : " + i);
}
// Constructor overloaded
Employee(String s, int i, int salary){
System.out.println("The name of the second employee is : " + s);
System.out.println("The id of the second employee is : " + i);
System.out.println("The salary of second employee is : " + salary);
}
// Overloaded constructor with salary 10,000
Employee(int salary){
System.out.println("The salary of third employee is : " + salary);
}
}
public class quick_quiz {
public static void main(String[] args) {
Employee shubham = new Employee("Shubham",1);
Employee harry = new Employee("Harry",2,70000);
Employee kishan = new Employee(10000);
}
}