[go: up one dir, main page]

0% found this document useful (0 votes)
14 views3 pages

Rockcalo 4: Theory

The document describes inheritance in Java using employee and manager classes. It defines an employee class with properties like employee number and salary. It then defines a manager class that extends the employee class and adds a reward property. The main method creates employee and manager objects and calls their display methods to print out their properties.

Uploaded by

Aditya Dandare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Rockcalo 4: Theory

The document describes inheritance in Java using employee and manager classes. It defines an employee class with properties like employee number and salary. It then defines a manager class that extends the employee class and adds a reward property. The main method creates employee and manager objects and calls their display methods to print out their properties.

Uploaded by

Aditya Dandare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

AStya Dandare

1313003
(Page No.
Date
rockcalo 4
ha cancapt
Alm alrile a proqtom do danonstrale
pause cday and dlanved cain jaea

Theory

The he maun
base lass is class
Boge elass
h e r e clazmved classeainant th featoe I is alda knoLwn
cu tho 3upeidasg o otd cdass.

Demved Class Denedlass is a clacs thd innei


ucla.s c h l
from o baseclass Tt is alla cnon a
clous

Code i
class employe

rcolecked int emp-no


poededStnnqnam
_crolecled int slan
pulblic mploye int fmpno Shnn nam nsall

mp-o empn0
name nam
salarySa

Teacher's Signature
public void emplo data ()

Syslem-0utpm ln C" Employ no. 4 emp-nal


Syslem oud pmntln ( Nome 4 name)

Syslem ous pmntlln ( Salamy 4Salavy J

class manaqer ex tendy employe


intewar d
public monaqe Cintrempino Shinq nom, int salint

Super empno, nam, Sal)


ward
dP

publie void
Public monager dasa )
Sysn ou pridln ("\n Employ no "
temp-n o)
Sys lem oud pntln (Name + name ,
Sys lem oud pmntn Sealany Asalamy )
Syslen0ut println C t Rewa d + TeLoUrd)

pyblic elass in hentan

pulic stalic void mainStmn arg L)


employe mp nw employe Cl Vamun", 20 000);
mp emplo dada C)
manageY man nau
mana qe 2 , Arun, sosoe t0oo)
Online Java Compiler IDE
For Mutple Friles, Custom Lbrany and File Read/Write, use our new
Advances Jan 1DE
-

3. enpioye

protected nt emp_no,
proterted tet

uac pLoyetint epao.3tng nat, Lnt sal)

publie vold enplo_data()

ystem.out.printinnEmployno,enp_no);
wstem.out.printIn"Salarya"+salary):
19 class manager extends eploye
nt reard:
22 manager (int enpno, String nam, int sal, int p)
ubic
uper (em
, Sal)
renard-p;
ublic vo1d managerdata()

System.out.printin O
trntn arsry

ublic ciz5s nheritance


36
3 p u b l c static vOld main(String arESLJ

employe Pne employe(1.arun ,20000


1 anaRer
manager (2, "Arun", 5000, 1000):
ana hnaEerdatat
45

Execte Mode, Verzian, inputs Arguments


CommandLine Arguments
1.0.4
Interactive

Execute
eu
and executed in 0.83 secis)

Salary=20000
no.-2
00
Reward-1000

Note

You might also like