-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSuperkey.java
More file actions
32 lines (32 loc) · 751 Bytes
/
Superkey.java
File metadata and controls
32 lines (32 loc) · 751 Bytes
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
26
27
28
29
30
31
32
class Superkey
{
int id;
String name;
Superkey(int id,String name) //parameterized constructor
{
this.id=id; //Using this Keyword
this.name=name;
}
}
class Employee extends Superkey
{
float salary;
Employee(int id,String name,float salary)
{
super(id,name); //reusing parent constructor
this.salary=salary;
}
void display(){
System.out.println("Id is: "+id);
System.out.println("Name of Employee: "+name);
System.out.println("Salary: "+salary);
}
}
class TestSuper
{
public static void main(String[] args)
{
Employee emp = new Employee(8,"Juned",90000f);
emp.display();
}
}