0% found this document useful (0 votes)
68 views17 pages

JAVA Assignment No.1 AND 2

Logical operators AND and OR are used to combine multiple boolean conditions. The AND operator returns true only if both conditions are true, while the OR operator returns true if either condition is true. Method overloading allows methods to have the same name but different parameters, without requiring inheritance. This enables static binding at compile time based on parameters rather than dynamic binding at runtime.

Uploaded by

Natasha
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)
68 views17 pages

JAVA Assignment No.1 AND 2

Logical operators AND and OR are used to combine multiple boolean conditions. The AND operator returns true only if both conditions are true, while the OR operator returns true if either condition is true. Method overloading allows methods to have the same name but different parameters, without requiring inheritance. This enables static binding at compile time based on parameters rather than dynamic binding at runtime.

Uploaded by

Natasha
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/ 17

JPR n65i4nment_

Enlist Lo4ical SDerato1S inSava

Lo4ica AND LL

)Lo4ica oR L -

Loical N01 (D

o GiNe Syntaz example

min-
Sunta1- MOth. nmin data lune num
daka1De numg

Dublicclass minimuM
axs[1
DUblic tatic void main (SHin
O: int c
b 2
Mgth min a , b )
{em-SJt p ln(C)-
Syntaz Mothsqri liaTune nu

Example

nlbic class O
pblicSEaie vOiN mdin (Ching arst

double ae u
alh1e b Math. saE Co),
(b)-
S u e m .avt pindn

Enlist inbuiE packacos in av?

i Tava ut
Define CaastLDctoxLiet tuDes
metnoduSed Lo
Contruckg is a
initiatize objects

De£aulk_Cantruen

Paxameteriz ed comtruc
No-argc CangALuctor-

lhat is clase & sheet


CLOSS-
AA claze i s a emplate
to cieate
COMman propea ties
Abjeck Hhat sha1e
ard mPLhOds

Obielt
member
An ahjelt in java is
instance s t a clasc

11c h Taa APT pOckAqe8


JE1ame
Tava fonlel
ki) JaLg Android APT
osCaca Igsa APT
in JaVa
List access specifieL
Defautt
PriNate
I ) Pub lic
v PYoleclel

Lambda exmescion
orienNed Praqammin4-
ii) OB3elk
secih a Dae k MeMg
i Absale
i Method YARRYPncgg

opRonal ctase
i.Colle Ckors Ciasc

Decode
ii) Bate fu Eocode

einalize uLth sqnkar_


State use
leau
Hinalize is osed a perfam
unmanaq memON held by CUme
Ón
sbje ck betane f dosiajed

SLa
Doecked void Pingized ( thm
Thioghle
itanINeger DateTws):

uhlic gaic Ne?hinaCftrig S)

it tunes oi iOneritance in TONa_


Singie- leyeL-
MuUR- lexi
Hiechica
iv Mu(tiple
Hubid
JaMG.
iSt xelakiona ope1atmsi0

Equaiity (E
(E)
ii Nan- equa lNat equa
mese Hhao (K
N G2eaker han 2 ) -
NLe& Hhan r equa t s KE
Ni ae0Lex man e4uaL a 2 E

Cive Hnis keu


use f d u h e4
Thiç kealod is uced b o e f e i o .
in_a
cLcent gbjecE in a method
-petbsd ConghNCtr_

Ou) ive Syntay n reate an obiece

Sunfa1 (iasfname ahiec ne Classcane|


clacc Hello
Noid how C)i
Sy fem.outprinta ClHello")
public tgic void nmain (ting s |
Hello obj z pew Hello O
sbi shaa
publicciass Main S

this.z 1

Duhlic tatic aid maiA LShLnA s1)


Main ok new Maia (
SySLem s/E:pinilA (obi. 2)

e1s) Exolai featr2 ofTQYa

ELame Abctra.ckion
Ahrhroctim hidea impoxtart and
mei2aNE de aiie and shon whakiç
Gny neNded b end-vsx
Fncap twlahon
ncape lakormeanc bundtina dota
meHhad in one vniEike clar-
-

Iohexitance
Inheaitancon J a a MeaS e

clasc i doNLYed Sm ilk


baie

i palummohism-

deha be DOcesced inma H


ome Pom

DiCfeyence btIeen vegm Arau

Necko

to cmO eleme yed- Size cotiecE


harna indo S eeme Ns
Same tupe n4h ita
eCr ik dunamic i) may ir fizedL
Sze inCrease ith Sine
nser on ot elerm?Akc
neckm occip
PeicieY
) Neckm i in) hrgic
Da isibilitu aantao

Packa9e
Dtitisiibe Onyihin. ctoe
PitemmUcally ed roLt no
sistailttu is_used

Aidle.
ata s isible onty ithin _clae
Cana he acCesscdatide tlhe cla

Daaici ble o Qll pac kage


auubelassee

Pubic-
DIa iç wicible evepcexe
xmain switch and candilianai.oler
i n java sith suitable example
SiEch case in Tava exeuit ng
hrora muttkple skolemesat bxeoik
E break
AAP a sAkmemts

adiional onerahm also knom A


einar opexam (2:) wav
a k e i f - elRe CeaenoM
Sunta2
aiable = (expeskion )2 alue if fie
Value if false

PA

ciass Ssikch public tatHc Yoid mainhina


Swikch (a) i

Seflem. 6vE mnH (Heo


Case o
Spktem.ayt-printin( wTld
deanlt
SsHm-of.pinkla (wOnA Chai
{Yte Y9om k2 OKtOtou sinq bubble So
CLOSS. coxti f-
Oublic t a i c oid Cmain (Aing s )2

CCini10,12sit

r i i s o , ilsiti
f SpStexn.oh-pintlnlanti]
Nnatis.cac.shuctor 2 i fuDes
explain Dnameired cm?iucin ni
CamvCEn ic tpeciai mertbDr ot
ciais that uieA binHgline-nbie
st Clacs

i No-arg Cmchnetm
i Pax amOtexi2ed Canchiucr
i De faut cm khiutta

paranmetiredCm fhvcir-
pax am2 krzed cm hrcm nik
accepR naxameler / ac amumen
Sxamal2
Close CmcbaueEoc i
Consbucn (int z)

SemoNt mintln
Pulbtic tatic vaid aain
(y)
Conctkr sh Con Rbuc s )Cina
CLO
0 2 1 )
Ditf.ex.e.rniae tsinq ic4 fe

SAin4

SHingS¢Lanu
Fogt

t Shiog ic
iom y ahle ig mtohle

ictakc- sui ig duraini

a 0ine ype a ing Eyplain tpo iPh.

Naka_ yDe s anat daka Hipe


Sunter
Pakic Class Conxe 1
public etahc oid main(Ching s ) f

SugtemOut mintln (i
neiro
025 De scibe eina yaiableZ
d yaiable2 LIhoa
orce any
tsdeclaYed aPinc IE conb
OssiALes once

u) LISt u mehad ktring ciar4

lergh ()-
R2han lergkE ing

Coniea hin uppex c i e

in blower Case )

cor catC)-

anstheA
T

a.a
p.AOkTin
2Jogica
Explain

O &2b
opR@tr
AND
TCoition i n boLh_pla9

sperakar ie la ilb rb
OR cmmdikiaA
likeC
Ean sf

class helio lhing st L


blietatic
void main c

a =9b= 3
in 3
( " I u e")
a v E p h i n t h n

Syctenm

b
S a p
=5- L
t e n n - o p v i n d l n ( T I e " )
dotcpeOkn
Dcccibe inetance otAdo cDr
i n TaMQ ath.efample
D t opLratax acceRf_piota
at abiect classesie Dot
allaL pOcLege Lase R

example
class dat f_
blir RtaHC oid main China ei.

dot obie now dat O


ohj. dispLay ()

Nad dRSplai O

Lfen-oi riHn (Hella;


,

2 8

Method dverluading- Method Glirq

)Nau O not 1equiIe Re4uir


ipkitance
inhexikance
DynamÍC bindin4
Rtatic binding ic
DRed
i s Used

OCCUIS laethseer
n ) Occaç uiHhin_
clascewith
clasc
re pa.fionghip

Bettex Defaanc2
PooY pex faman.co
dQe to cMplle time polymophiSm
ime palymaphicm

You might also like