0% found this document useful (0 votes)
9 views6 pages

Java assignment

The document provides an overview of Java programming concepts, including object creation, polymorphism, abstraction, and memory management. It discusses the syntax for creating objects, the importance of constructors, and the role of the Java Virtual Machine in memory management. Additionally, it covers topics such as method invocation, class structure, and the use of keywords like 'super' and 'this' in Java.

Uploaded by

bhanukiran1511
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)
9 views6 pages

Java assignment

The document provides an overview of Java programming concepts, including object creation, polymorphism, abstraction, and memory management. It discusses the syntax for creating objects, the importance of constructors, and the role of the Java Virtual Machine in memory management. Additionally, it covers topics such as method invocation, class structure, and the use of keywords like 'super' and 'this' in Java.

Uploaded by

bhanukiran1511
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/ 6

Kseknau?

22L3IAOu{9
JAVA ASSIGNMENIT ECE-B

k y urmd folowed

Syntor to (eate obhjet ? he


new

)
Tn Jova, objuly
(Heated
wing
pahen thLU.
name
an d
clas
by the
Name l :
new Class
$YNTAX
objectName class om which you
ClassName hame 4 the

ClasName : This is the objet. efey to


’ want to (ueate an
that
will
name
vaiable
This ib the
’ chjetName :: nwty cntated objut neU
nstan ce
a
the
to ceeLt e
is wsed
This keywotd
It iS
the clav
nw
the
clas
Constuctot
the he cbet.
() : This i to inittaiz
’ (lassName stokked Calle d

polymophism ? as
dynamie poly monphisn
Run - time polymophism , also
known
phoces whue
the

Run- time dispateh, is a ot un time


A) dynam'c
method
is deteH mine
d
euted
to be es though method
OM
methd time . This achi eved
spufte implemtatian
not
duming Comprle
subclas puovi des its own
whue .

ovenhi dingmethod alMea dy deyi ned


Supulav

the
Java Viytual
a
objeut
objd at
on an
i Calle d
When a method
the atual type of the
Mahi ne CTVM) detemins
Qnd ereuty the method acondingy
un time

3) Absthaction ? objut- OHiented


in Java is a cOne puinuple of
Abst4action
hiding comple inmplema
A)
phogamming (ooP)
hat focuss On

sental jfomation
- tati on
detai and exposine ordy
and
olouus
cdwtlops to with Sim plifiu d 9qphsen
It monaqeable and
o ohjeuts , moting code mow
- tot ons unduuland
easi to

Structune d Joun ? on lanps, whch


which dyi'ne
is based wust
Sthutune
Jawa puoqtom
f objeuts Eoch
puogtoms
AA Jaua ond buhawion exeuton beqin
Mt
the sludtue
strwtwe

clas,
and the progt typic
least one Jawa puogiam
hawe
at main nmethod withi n a clous paukage d lasati on,
with the doumuntatt on,
nihoy.
dude seti ons fon and cls deh
defi
in intufacU, that
- impont
olly ments
Statement
ate
commint
ntains
sutio n
Sution;-
This
funtionality ,
and othet
Doaumentation

I) pupos,
puoota is poekaqt to wich
erpain the
infonmation. speufies the
eievant
statument clasey.
Dlatation;-
This aelated
onganige
2) PatoQe hping to wed to buing
cas blongs, statemends
the Lmpont
Hhat the swnt pogmam
statmuds
3) Inpo t from oth en patkages
clases methods that
in a set define
needs Tntenfaces coupbng Qnd
Seution:- toose
) Intuface imp k moyt, promot ing
clasey can
Cln dyining the
Pragram,
po lymon phis a Jawa thods d
definiton;- The coHe behavion
(me
s) Class fild ) and
nethod
(attnibutyl marn
Sthutune
clas (ontainy th Pxtuti0n. The
(lays Thii
Method
6) Marn nt foH the
entsy por method.
whih
publ'e stati void vaiabus)
is a
main wethod
the ft
contoins Hhe
tontains ds Cdata
fiet ds
clay body
2) Clus Body:- The boy deyme the objus statt and
tho, ( fuwctin) that
n
bonoyi.
ollttow)
The gonboge (ottuton (a) in
A) bot kqoond procs
he
Java Vintual Mahne (JM) |hat
Outomah coly monag
by the
memo%y bttuptd by
obpds hot 0
no (ovg in pplicabom, ptwem
(eaka and
im phoNing pnfomane phusn ting
ting Memoy
Tduntitication :- The Qc id entilies ohj ets that on
longo Meochable by the ppl'cakion
Reclamatoni The Gc Heclai s the memoy ccuupitd
these un Heachah le objeut,, moking it awai la ble
by
fon futute Wse.
featunes withou the need
’ Auto matic ;- GC operates aultomati ally r
intuvention.
tom expbat puogtomn memoky, whe
manaqes the heap
remk Movogeert- It
objuts ete Sto4ed.
Meclaiming unused objes,
’ Pnevents Memoy Leabs- By which Can (ause applicati ong
leaks,
phwert, me mouy
down OH ayh.
Slow poufonmance
application
Portomane Tt helps impkove
Mesoutces.
by fheung
dont
Bent titsi Monaqement Bunden Duelopes
Reduced Memohy
ned tomanuoly manag fuevuts mtmohy leas
I»puoved Appication Stoiity
and Helated iMuy
Usaqe, teadinc
Pontomante;- ephmigs memohy
enhanttd
to betten punfomane
u M e n t

he
o 14 to eiminate

This keywondo kywond


fus

koyuchd
mcteny
conathuclo. pUH a
fhis pao
he and
and
7he his o atHibute
atuibuty
on us
thod Omon
c(a y Paromte)
me be couse a clay
moA
erampe above,
t h e o n f u i o n b r t w e e n

The name ( constHu


cto
Same
thod
on in the

a me "g insteod "'s"


the
t h e k u p w o H d

with

Shadowtd by
Tf yeu omit be
would
the output
be cused to
cdas constwctUH.

also

this C w n e n t method.

’ Invoke
las
(uHent
went clay objet

Tnvokr call.
’ the
i n t h e m e t h d

call.
’ Rettn n cto
angument cons tru
) Pas an
met
in the
aHgu
clas attibute ():
Example;
with
this
Using Main
publie
cias
ínt with a panametey

| Constuton

Main Cint x)
public

|| Cal the constutoH


public Static Void main (sthing CIawgs )
Hain myobj newMaih (s)
out- println ( " Vaue e X = "t nyChj -x);
;)
Supn kuywemd Sa edeeret va.able

The Supe key wcmd


2)
that is u d to nege
cbyct
UCMking
The
Super eyucmd
he
Subcla t coytmtom ntds to
ohet Car be
constucto ct the poent :lass Th
with the help the Sup keycd
do ne
the pad clays
it calls the Corstucto

to
Atussing
acces
be dont with the

clas
in the Subclas
State Contut:- lwe cannot use
Cannot be wsed a d
netinod
in a Stattc Vatiable ,stat

Stattc biock.

se ot Sup with viab les


trample -
Class Vahicle
int mar spetd

clas Can erttn ds Vthicie


int mar Spttd = 120;
vold disp lay c)
C°Maximum Spee d : " a " n S t
System. Cut- println M
claxs Test
stotie void main (Stning (] onas)
publie

Can Smal = nw Ccu ();


Sma -display ()
C

You might also like