You are on page 1of 53

JAHIND GROUP OF INSTITUTIONS

Name -Class Roll No.

Subject -Topic Date

T. Trtodudion to Idont

1 lhad akt impoxlad lemudu otnet anduitulwne 9


Modenm
TSP
outvu
Lnderned
.Baexlaone
TP TP
Nekwo Altm Polata
omain Noune Svt ce and DNS Senveu.
JAIHIND GROUP OF INSTITUTIONS
Name. Class Roll No.
Subject- Topic Date

LNTRODUC11ON lo JAVA

mauk

o)1. Jawa Applicodion Programmiog Iriua a A1


(2016,19, 92)
Jawa APT uaa numbu
Jsit danes and mdhodagDu ped rdo poukag and 4
neuded wtthheJawa Deveopmot Environmut.
:
2m)Whal bacode 1 Jurdy houo Tava a plalonn indepan
det (2011, 22)
awo be w de oe a e i al se mauine
nakruti o that atanotSpeico ay on proCeuO
09 Compudr 3yatum. platoumApeuclba ode
vtexprinexuta
Iduupruin u Jawa beod The byta
code touprii aluo lalled heIava vintual
wauaine 09 eova uuüme psti
PLatosun ndapendenu meanu hd a proam can
on au Compul Se Java ogsani Can
AuN 0n au ytm hih a wa k u l mathine
ha ban taad

2m)3.ltta a wD Chanouloiatio oSava


00jut O«ferted
mple
Sened
Platou Tnde pendunt

2m)4hod Java intual malin and hor tonaidered


n eovident Java' platfok n depen dud akuwe.001)
Tawa Viual MaaneIvM u h heat o
exeuti on proc ruponi b 0
JAIHIND GROUP OF INSTITUTIONSS
Erel Class Roll No.
Narme
Subject - Topic- Date
ah bye code
loadingcloa l and Con veedi ng
ndksudi on tho
6EAplain he okunu Jwa
maclane nquaga
wnderlutn mi oprwtnto
tan be c d oy Strpla Eay do laan. Betas Taua înhyut he e Ca
ad(owm nda an dut > Rb92 nkon and mo o obu Orotad r u C

6m 5 Explan wisto y and


wDudion ol awa. (2016 Seusne Tava povide a ewall' oekweun a ntuwoKed

Jawa objacd- Diuted prosamminq opplitation and uou wmputta


a iq. wl
dev elo ped Micod sytema
Lanauage by the Sun
mind Ue wnumUL
Owly devdopedKee ping 10
Portalda:raulding a Taua pogracto outaode maku *
eroniua un Communi cali on
9 u i pn i u muwh t a i o ru a progran n a wtde Vaui t
Came Patt wdo amücalioy ewionmd
Web ovtcu and a pladoum ndepondent pDsamming
Languoge tn he 1990 d) 0bi t Oitad Java enhanu and unu Hne obft
1qa0, dama Goding, 8 Joy and btheu at Orfanbs anadlgm ed C t T n e obut mod in

Sun Miuo alem Calle awa u mp and, auuo tnd.


be gan dveloprq a
Oak
Thay wartnd 4 primai u to Dntrol mio poDcemo e)Robut Jwa iminda mumo Managmed problau
enbeddedn conumen emauh as Calole op oox &, MaulagAng muwor allotatiog and de-allocaki on..
VcR' toaiu, and auo fo personal doda istate (PDA).
a k needed to be plakoum nde pendt, xtemey 1 Mull rtad awa supposdu Multt- thrtaded poor aummira
otuliob P Coenpotk. Koheth olouss you to witeprogramuthod do may
Sun ulutd u Ht public mplumut atiorn as Lmultanewum
Jana 1.0 1995 p D mised OiteaOnu,Run 71 .

aw i aoum alion nad


Anywhe e LwDRAJ, povi ding no- cot SALn-timu o n
2)|n anic awa proqrau un me

aknu to obf at Twn um.


Popularloam ud to vei andTuowe
O13 Novembu 2o0, Sun ulaated muith o Jawa a
and op Sou Sowane undu e ium O he GNU h 9edvf buted Jawa duiqntd om the dt sti buiad envionnunt

te wteentt buae handus TPT pobco. T


Guusal Public wne (GPL)
makut h dynunmien inki ng code n a Sa Maunn

1)nhilukwne : Iawa duian oal wau W He Onte, un

a nam, Nut-ral
wa auhi ived.
JAIHIND GROUP OF INSTITUTIONS

Name Class Roll No

Subject Topic Date

Itux prchd Porormanta Jaya be ode (an be dxprdd lo Mullupla nneritonce n TowaMulhplh uhritante sdue
On sytem h d providu a a JvM, Tawe u wel
loued ture u uouu o athive ?t awailahl n t4
dui gnt pyoun wel d vo ow powe CPUs
auaüloble There ane wwtTuurs 3
O R l y Conukrukors one

9n awa. No dvt rutkors n awa.dutmtonu n C


W Jawa Aimp Mtion ay wo alonu.

Jawa COnuderd mua cfmp ound O tw wi


a
Dbtd Ovierad Jawa cupposdu 4 au cpeuu kee oe au cpeuikeu in
pvogn ammin anaua t Companed tothe
and
OoT amming Languagu. Jawa Te plated he Lomp lunit gi vate proltad, dejaut
muki pla 9herit ante c a wft a tm ple struukne pubuc privae. publue, oleded
tuace, d aluo: ha diminatd the we
lo qoto stadenaut 9n awa. C + ha gsto statunut.
Potatp

shoir
Muuneaalon o onite oug r wda. 9erene bebwun TDx and RE
JaNa ha toniderabb moreuni onality than
3Dx (ava Dorelapmerd Foeit) JRE(Jawo untime Envi-vonmed)
Wrk, a dvnu bokwun Jawo and t t
4&bundlu osowa aat ou an mplunantation o t
Jawo C44 tan ule to develop Jaua loaued awa Viual Macine dtth
aPpl Cotio aukually xe Jawa Prq Tam.
dawa pue objut Ovimtad C4 D t a pune obfu
proammi Lagunt.Evouiq |Ortutad prg ambmi no Lav La Jawa Porolopmerd KEt & nuded Jwa uun Time Envioran et u a
nawa pod oa do oly 1o an writ Ctt prDaqm
T U
p devloptng fava appk cabionu pag-nneuded jor Tunnina
wthouk ung a dau oran obju|

No pof ilou în Jawa Potrta n C+t


3DK netd moe dak spae a RE smaler than 1Dk
Cowt aim JRE alo aious Ao 9 neds lu Duk sp aee
SvM ta Coe allotaing Aloodinq and, daollodin devdo pmud tool
and de alocai noq mumor memony uthe
aporai oiliky
pgTamm ID ean be downoaded supponkd JRE can be dowlwoded
ronaw a Aun Lom
Aupponied 4 m ava.
lo .Opesdloi oredoading In Sawa. perdon Ovodoad'ng awa laldle CoM
1nt44
4nuludu 3RE, s oAPI nuude JvM, Cove
JAIHIND GROUP OF INSTITUTIONS
Class Roll No.
Name

Subject Topic Date

elaue awa omptl, webstant | in auiu and bh addiloval


additiond Jile ne ded to Componunti lo iun appli cali o vviw JaNa anouOgl.
oile Jawa apltuan
and appla n Tava
pplic alion
not

1Explaln the unepubli dalic vofd min (Std awgs[3).

The ouinstpt an, hawe wnilen only one


mehod puolic lotic vold
called rain trir aw 1).
why should we
wTite main ) mmhod ?
Betaue, man t) mhod unot win n Tawa

TVM wi net exeuta , main ) u he da arti


Pot TvM o stad exudi on oa Towa prog sam.

main t) dedannd al public ?


The puolit *yuwond ana peuite An
OLen Speui ddtn minu owDthur pae Dthe prDaram can

haduwhn a dau membon u

teded lby pulolicy hans hat amlotr Lan be a L ed by


tode Duai de he dau o i delarud
Lae, man t) mu bedeulnud a public, sfnu mud be
Lalled by tode oukside. o clau when Hhe proram

ktwtid.

why mant ): i detaned ai stalic?


muthod tan oe ealled and exeuied ?Hhout

Cve ating an ob oelaa Sinte we want to call main


wmuhod whout eeaing.any obiut. we should deulant
Mainl) a s4ati c .

why man ) deulanedau vod


The eywond vold stn ply tl the tompiler that
Maint) douno nekuun a valun . Thene n0 pofd Pn
0).aiAL JAIHIND GROUP OF INSTITUTIONS
Name -Class Ral No.
Subject Toplc Date

valuym nmain ) melhod and vn Woumud alion Sudi on:


pelunng n a

un valuu 4m e dun valua qou do SVM This sution


o tonhmut uond conustu
ram o
h e ally mhad w oumy ud ungs. proam ne auhan dts eneatad and pose rue
can attapt Somp dd 0oud sfde.
Lommurls dps n undrtand d PrDaran dou.Tr
4 tan auo nukusn Some valu. hdpsn odabltstyand unddandabily a pzan
awa derelo p

hd ina aasLJ
mein (med auer angumeiu a t u a qrou
Paskage tadamort
0Tawa ub<amy onuus Tud poekanu butd on
cing www dh u alco t allud al S
huntionoli4 Ea paekagt onusk d d u ad
a x a y i n g axgs , where s}ring Java'

gedene cla on ao L1 u namt o an anau nturaa Eaah dlau Coust Vauiou m thsd.
pauk dge latemut toll t ompiler d dau
pa sArine uke RAMA" and STTA" 4
deied hure holo vay 4t Hu cknge
0g 10JContaim RAMA and oogt1 ordai SETA
atkaq artmal
Jawa ogram Struutne. da Doa
Erploin

ouumod eduon Sedibn


Palkage Steernnt
Imppdsl atamet
clau trjau dedinition Impoud S4alemurda :
tdaA The mpod 8tatemant ane i milar to adude
u a Mrned
Mdhods Matenun fn C. a p nanmt wanu

n one a day enha dau showld oe tmp otad


84 demed
| 9to prDaran Suppose, wewad de wi dae datd
memods ta ou r g s a m , then we chowld tm posd Dad dau
cls damaVau ablei and Dat dau lone awa. util paukaqe.

egimpd awa. u&l, date:


Matho d
S4al mo clau and Sdu ta Delinad.
The Aed Hing atumposd slatunurt ane dekn
daxu or n a k . clan anl udi al pavd of awa
elau Taon ate Nasi ably progvam .The cldi u ean toueoi Vai ou mutho ds and
ndance vauablu. A awa Proqiam ean odrain multi ple
au and Clan May one 09 morz vustanee
INSTITUTIONS
JAIHIND GROUP OF
Class o.
Name
Topic Dare
Subject

Yafable and nilhods

An dua man to adau ha wwdain Jawa danauagt fundamula


wimplemvdmdnod and public slalit ftnal telda .

.Wha lnkante Vasiabl Gtve an nampl (2o16)

dedaned 4n dau lout oudide a meeod.

|nu an aluo talltd mumbe on ftedd vaiablu. n rdance


aui ablu (ratad onn oeju edad ard dudvoyad
dhen h obfu dukroyd. Viaoh n all mhod and
Comtrute xu o e dei dng dau shodd genevally b
deulannd pvivdle, bud Ma be gven grotu visioi
on objd 4 alloedad inheap, a a t fn
on lath t a n e auiak le valut

eg Publkt dau atante Vaiaole Suope

x Lndane Yaabla *
rd a b , e

doulole di, de;

pubbe st dse vo1d main (Sinq ang 11)


1 kotal vasioblu
a dt X» t0, Y20, :30,

f
a
ten 0ud pridn ( utanea Nasuzabla Scope Demo

Mudion he dada tup tn Jaua.D13)


nktgu BooLean
Ploaling 9otnt
hanaubunu
JAIHIND GROUP OF INSTITUTIONS
Name.
Class. Ral No
Subject Topic- Date.

3. Wlhet an dtng blewalu 1(mi) Sopanalon o


stringulewal a seqanu dnanailu
oih has l o doubla- auotd ") and
Dt on a ( Pan onhuu Can lot td to vdablich udne vod tlet)
line nan x opion on to tod An a panamd

0 t lbuog called on dulared


loh mudhods t3«(1):
in
wha aneh
deland Yaluu olod and than printiv
dade typu n Ta (301g)
L br aukcdu serud tha Indexan ana Jowe
oa 0.0

han u0oDo los ouxiu lnute ad o pananthed p an


o thatho ou of tonued woth mutod

5. Whal &System. Yn and Sylem out (o19)ts


hle Con Tad Tawa's put kon Stum. n" unly brauu ein and d a blou stode pubae vetd daaut
Consdle and ott Dutpud tonole winq"Sytum.0u"
&pden d prinn
Qny tuwo rula. an deu iw. (90) OAilo, wnd");
Dou not allo space lbtwen ndoditn
LdenlHe a Cae SentaVe
May CDniist eHu. digt, unduucon a dalan nasl Senicolon ae ddimitu hat mark ha end Sptern.ok-pridn
Mu! skad wh an Undauore (-) a t u , ora doll eStatmua Hollo od3° )
mbol (}) fd a,b. t
Jawa Ruowed Woad Canno be wed o an 9deilifn.
Comumau ae wed epenote e
axiou sepandloAJ ud
paxdu dolay to.o,30);
Sapanatoxu Qurbe he a cst

n Tawa. (2021) c
Sep anadoyhalp deant he rukune Poodae wad a deuinal poids and a Suen. pud prtndin
Tre Sep onoto oluó known oa punckudtos he 9awa dlniteu o. ink ontonuatanate mahod ta Hdb wonld");
Comples be Sepanátor brok Code d Segme and Ceprate them nau namu. DbieaDbjed mathed(n.a

lad bype cattng 1 k mauird tloo


i ochieveds n JawaC02
the
Carting proc Convuding Die vauioble a
Cetoln dtaky pe to anothen dola 4
INSTITUTIONS

JAIHIND GROUP
OF
Pl
Class
Name
Date
Topic
Subject

14 uindto dly tonvdi vg


o valu o an
An evidk tast a

Db m one a n h Cypenama) Volud


h e name o ot
In Jo,ename
tonvti ng to and Valus an
a) 1mpli Cading udod to Convet
Aulomalc Cotin done y th Java (onpfle 1donaly n al we

telld iidta.i inph Cating done to tonved


dousls d:63
lown daia do ohgn
n ) d
whun 0n aiutgned to anothu yr ol
dde
Vosdoble asdon edic Convekui on wru take plate
an
upt
com pati lble i

he dounat on larg than Soue *

The plidd cating uler.

double
Choed d long {lat

tha C

1D

Ex pl Cading
The cosing dona by hes Jawa prognammu 0

devdapi taled Explidt i g .Expliak caling4 mut


ila tonvoding onahigha dada type o wen dada

.Conwisdinglous dade ye to ghe ddh kpeitallad


otdaingnd tonveing Maen dola pe do Lowen dada type
4talld nase
JAIHIND GROUP OF
INSTITUTIONS
Name
Class Roll No.
Subject
Topic Date.

Aso 0 aive
5 C t da xpuson yolu oad ria
oyharumb o 1111
kSpeied by uion Operand and tad
aduesoAld
Explain biluofse and logfeal operaln xamp leyo6)
(2o6, 1 ) cogcapoto kogi cal Opewoks esra a tnu ole
aBlwse One ae 4 woa 0n bft andeom bby Nau baued on he ati aiablu.
Bt+ Opevde on. Tne opeati ou Dn t u au porsonmecd 0n 1

A boDoII lo0
and Os ory Ducdyio
8- 13 DO00 O Openda) Exanp
Ex ample
A: 11e B- (alue
Oer do JetRpioDn AND Operdos. looth he 0penand a nen A48) Aalue.
no an wndito n bo mu u
B?na AND Operatos topie a b o he(AB) wfU e 12
6
94 eisu n both opesandy wwun 0000 1 00.
Shost inai AND Operdtot. 41 boh Ahe oerans| (A4 8)a sae
ane non -1uo. tAen the tondtio buometnu.
Bnay 0R Operato copiua bt tt extst(A1B) oil give 61
ohich 00 1101.
Onther Opawannd.
UR 0peraos. Lany e two openand oe A1B)bu.
noYLt-O e r he Condiidn loLomrrL
Bhau XDR Dpealos coptu e bt t uCA 8) wgve Ha
tn 0perand but not botnh. tdh u 0011 0001L
Ad one
Shoot Corui 0R operaton. an a d (A118) 4 a.
CA) wil gtve t0 l| 0pesands ane not-eo hen odition
8tnau Ons Com-plumen Operaot wna

The oerand, A2 ve h0
wi 1 A, Exduive :OR Dpecato LxDR) TA cuun tu AAB) tu
Blnasy dlelk Shilt Dpenato.
vaue wovd t by he numo o whith y ti dooo. Dwluy operands ONe dudt and alke
bru speulid by ot optyand othewise.

8tnaty Riat Silk Opesotos. me lak operands |AJ wf dve 15 dogieal NOT Opesalod . Uce Ho rwue the legialCA448)
walu u movtd Tigt loy he numben o vohith u od0o 11 oAoerand. acondizon u

thenogital NoT 0perato makt aue


i Speued ly he rio operand
ar
JAIHIND GROUP OF INSTITUTIONS
Class Pall No
Name
- Topic- Date
Subject
shonkuds ?n, tommon oammir ,,M=,
(om).Whad &condiional Operat 9Gve an example (2023 Shorlhand u
I,,L,
aluo *nown a Astgomod 0peralfo. u aluo talled aCornpound
Cond tiona 0ptrdox and augnmud opematos3 ,
pevaton. T operoto Conufst o Qperater
Vani Operráio an
wd to evaluada boslewxpreuion The oal o
augned to
ope dp deude toudch valu shouldbe
8tise woTKu on bi and peosme b4 b 1,A,n,
he vaiabe.
L4, > , > .
Ohen odon Opewation he 0pe vadtionu bl
expruuton) 1 Yalue 4ue : Naa aue. Poyorm d on s and
Us ory.
Vaiable x

b a-1) 50 100

3.Eplain optsako : Sawa.

Upevatris Quipion Cperodo


Names
rthmdseaed to poun an bak Jowm:o maenais. l
0peratox

Unax Unay opesato u ane he opemalone -that onlg t, tt-


heraloy Ttaut One 0peTand

wo. yauu
Risti o hey a wed to peyun o p one

>, ,
Openatona and debomine hu dadionmi bekuoten hen

dogical 1 rdon a tou o talhe waluu bdtdDn A,11,


Uper doxu e stae. e Vadoblu A. 0:

Assiganud The auignmd operdto he stn

Dpeidoustn.
Van-xprenion

conist u
Conditiorl T 00enatod operand and 1
Opevratou uRed to walu ooolean expruou,

Vasiobla y lexprunion)!valus e: value


JAIHIND GROUP OF INSTITUTIONS
Narme -Clasa Roll No
Subject -

Topic Date
Covlenut

6 Cowant Slad tmenlt


Can ov aptan wihin a
Can ool pan wo?hin a
wdsalernud loop but o t In Swith sbhm-

G he 2EY pum o Sol tthsBafunut. (2o1 o18) ehiu Ctondlton) hie lwndkon)
Swih expramon)

CaLe valui: luondtion ) (Condibon)


li'Do Valuni thi brtak Codinu,
btak;
Coue valha 9
1/Do walu hing
oeak 9tademed -x Stdnud -x,

deaud : &q: D pdt ruumbe son 1to lo 10 piat numbeom 1t 10


1 Do deloslt ation

whi tna)
8what Labillad brtok and labelld todiue'1 (3013) C45 2 0)
1) Covdtinue,
stedernent tran u totrol oud break Stm.od.prindtn ti)
olabellnd bak : The brak
the undosl loop. We we a bTtak Stduned ohn we Syskem.oul.prtd nli);
oard toump mmediad ly to he stadunet oloyot ng he
ndostna, loop o swftu.

bLobulud tontinuL u tovdi nue slalened trans{u tondrol l Oulud: L1,3,4,6,4, 2.8,9,10 Quhut1.73,4,,3,3,
enulosin loop. wDe we a Covdi nue ctadement ushen wee
wa o ump mmediatuy to h terati bn nhe
opbSpi cwa ud 94erodion.
3.Omsda oekoaun lovvtak and tonti nu sldend.
JAIHIND GROUP OF INSTITUTIONS
Name Class Poll No.-

Subject TopiG. Date

1oLKagu
1

u t i a tConponut and Contain daa. (016)

Componerd daw Covdalnuw lau

The clau comppnert & Th cdam to ntaine te


abttrat ba dau ot e Aupeulau on the odainuu
hon- mun w tuace wT
Controlu oAwT.
tom ponud sipsuoi an The ontains objut tan todain
obut o? ga phi cal Tuprutothe AUT tom.ponut
-ai on.
odens Comonant elau denesCotain povdu the ovvdaadad

Munbeu oh mathods Jpu handling method dddt) to nuude


ewuda,thang irdouw bound, tomponut"h the ontalna.
Lontrollivq d and coou
|drvawng &omponetu and thisi
Conte
Tha tomponud dau ound .towtain ou prov?deu he Spot
buildinq compar hBuanial
wnduu fava. AWT Pockaige
9raphfta u t n ae

9ne a ack.age. Mnton u u e . (2011)


The datd daa
Packoge u logtcal Ostgani ati on
We tan ocally 0ganin Jawa tlauu do pockagu.That
meanu W L rletad dauu tt» onë package
ateuibethot
n a paekage, we can deine ode
Dth tode wffin e Same paekagebut not by tode oulide
the PasKage. Th enalolu t0 Creat utonained aops o
latad dlauu hd ep ha operation pstva
JAIHIND GROUP OF INSTITUTIONSS
Name Class Rall No..

Subject. -Topic Date-


on) 3.Ge atate ofth one Nam ple. public vo?d un dion M)
gunra DRm
ej4) Avn 1ntae a pTO qTdnmi ng corlau whic
muthods an d publc
ont ains onlu puldi e alo stract SyhunOud prfnkin C" Yotd puntionM1);
stai c Jnal Naxfabl. .
A Can be dened e a
Kuuwod
vrlae puolic vofd un dion P.01

I i a z Irtenae-name Suslm.outpri n C otd undionPti)

pub&c static voniablu


pubic obytsaet muhod1 Jc 0 dou Intnsate Multi

puoic Atatic wotd malnString ag L3

ABC a1: nu AbCC1

a1.kundionx 1
a 1 Junction MU;
pubit vold hundionxt1 e
a1untion Pi
9 n o MSD

ulbic Vo?d nttion ML Gtve he ep o Cuate and e a JaNa ockage w


an an ple. (2016)
10 CTLate a
Pakag, pu a
packaqe mm and e
denjau PR atand x11 MSD o oJava Aouu le The elauu deulnd wthin
wT then belong
pubic votd undion? C);

Guaralou
ADC mpternut P6R
pockage pouk1
public Noldundionx L), S44p to Crata a en dned packagu
Systunoud.pritn (Yotd undion x ()")5 pat
SStp i Create a oqram wnth acka
tallud Pack 1.
INSTITUTIONS
JAIHIND GROUP OF
Class Roll No.-
Name
Date.
Topic
Subject
the
pauki
Packagt Pax 1 In th an twytn to tnçout
ULauu ond CTa n an obju opakag iau and cal
qublit dau pazkag lo Par Mehod).
Pulo lic vofd pauK Mahod) e y : Plaa fi aluo hd ?n tt d compi le h

progam i n d option
Sutem.0ul. pridtn (" g'm oux Muthod ) n azki.
dirtoy ereatd
paukage ") Tt Vouy cla hdPak
alu Copted to hod di'Tdon audomati-
and laule ia
Cally

Place hi A pack avarin Ci and tomplle tomp?lation alooth dauu ane omptuhd
the

pgram We hawe o e -d 0ption (mate the


Now lut w exuuds -e poukgeDen0 ciaa Go to he
th
Pouk 1 dirutoy ad omail calluy. C1 Prompt. Execde e i u n g
The tommand fawa e- pokaja jowa fawa patKs. paukagt Demb awa
auomati cally otad by he
Poxk 1 diruouy e

covdLin Tawa.
Comprla Tne Package. clou wUalo clol prut dhe 5 . E x plaiy v?s? bi liu
tn

Java pTov?du the Auw Control ModifRu


Soeume disuto
v?stbity Covdrol) o Tutftting the aura twa dou
Levs
Stap Cde anothe file called pockooeDerno. awa n ond 9 mumberu Ihe a u u u qranulated rta

Dack poukag. brom mostuti ttve Cprivoda) at adt cive (pubbu).

Pauko i a)Ptvate"
o 7Th pvata moco speu he most u t i t ive
method and Vasúable
Impout k i , * actus evel. The Rvate Thwu oe te
oceeul ble ond wthin he dlaing
dau paekagu DernD e a MUmbuu e muall deulaud prvd to hide
Publit
Intesnals e a dau om h othn danei
ublic stadic votd main tShinq asgsL 3)

adkahe 0b n ockage C1
ob.DaukMihod );

7
JAIHIND GROUP OF INSTITUTIONS
Class Roli No.
Name.

Subject Topic. Date


defauls a aL awailable 4o al hu dauu s?thln

Sone Poskage ohih he dau dulanud.


lo pivatu Exampla

d a 3 l
r
PotKage aNa. bea

Vod dealtMehed t) publtc dlau DeaulU Examph

Sytamoud paiveln " Tm deaud muhod); rt a o


orai Mmod (; vofd delault Mthod

prfva vod r?votsMethod ) a Syttum.out. pr?tn C 1m dault miod ");

Systun. Dut prittn C" T'm patvate mehod"),

pubuc elaus Deaut Deno

Pulic tlau prtvtDano old main CStlng a o L3)


ubltc stadic

publlc Sstadic vold mainStir OA L3) mor


Dadt Examglu oej nw Deaul Example t),
Db.a L00
piwataExamplk obj nauo prWah Examplat)3 b . delawltMUhod )

obt. b 3a00,
ob. deaudt Mthod );
Do rada Methodt); CPoded
A proteuked mod to appltcabla od to muthod
and mumbn vaiabu Smilan o u prfvati modiftuu
we Cnot apply rottttd modehur to a
top- aveda
0Jauls The muwbor aialou and mbho d oa dau,dulaud
Ohen a o , medhad 0L Nasdabe dedooation dounob a potuted acenioao all elaneu dn Same packaye
hawe any amu modi to,4 wu hawe a deluuld osc and all Subulauu o e dedaning dau In the othu
Patkage acreavl. A dat Dx 9 menbou w7h naatn 1 hi sabdau
Packagu. gh dounot u
deined
JAIHIND GROUP OF INSTITUTIONS
Name -Class Roll No.

Subject Topic Date


n dewd paxkoge li u
Pro chedExample obj nus Prokrd Exampl
0b.a-100
DoprotecdtdMhodt0
Paukage awa. bca

public elau pwlechd Exampl

d)Pubic
rotuted nt a u uot uwrdivt o al
TL publte mo dih Hu
pDtecdd void protetted Memodt) u. Wecan apply a,?t
octe mod a

meho da and 44 menben vasúablu. APubiic dou tan

Syttem.oud. pintin "Ta prthd imethod "); be tntudiaktd withou ara Tuer ti ons
1. s .ra/2

mdakte aes paansTeeno atkage jawa .bca

package jawa. m.ta, pubie elau Public Examplu7

Yon pox jawa. bca psoteted Exampl pubue nt a


pubic Nold publicMhad t)
ub lau potetud Duno
Systun, out .print in "Tn publt method ");
pubhc 8taic vold main CSting aot 3

Prodechd Exanple ob nuo Psotutd Exanpla C)


0b. -100 awa ymcai,
ob.pooteetedMelhod )jtan t
Rmpod jawa bta Public Exanplu'; n

publit laus Paulolic Dano


puloic clous protad Dmo elen Pokuta dExampla
Publie static vofd main Lstntnq ag L
pudbestdic Voldmain trina ags L3 gs3),
JAIHIND GROUP OF INSTITUTIONS

-Class Roll No..


Name
Topic. Date
Sublect
butwun dau and ?dufar
publit Example dbj nuo abl'e Examplu ) 8 lhod u the dilkeronu
Db) a loo e

Db.publcMathod () 00 Clas
Tdur)ots u u l uwwimplunutd
clau uly tmplamudad
Hruutne truturu
tannot be lndariiotr.d
Jawa? T can be In ttadiatnd
6. What al dilked aue modi/iou Tn
.It tondau ory_na
ptvate, dejaub, proteded, pubtc. 4 Covdainn:oth 4dle
non staic vasiably. Vai ablu
abstraut
No abst« ad mito ds ane 14 allowr only
What uthe dillerunte btwen an 1tuo and an
allo wed. methok.
abstmat clou Co19) Tne Tntnat u dulaned
The das u delaned uinga
Alostsaut dau he Kywond lau. utna he Kuquwond 2rtorac
nturfat eau carn evund oly one Tofaeu an enkends mot
ban one ituacu
Abstrad padialy nplumutad Dduroc l y unienlumaitud elau An ttoare tannot
and pavdially wimplament d sArutw Wastu mplenatu Intunfac
mpln en anothu 9rtujate.
Hrud ne
4 4 wd ohen theri oe '.L ltd wun all he
So me Common tatunu chantdfeatiunu ane Implemeited
by ol bhe obj dievolly n dierod dejut . Explain de dhhTot fpuu o mpum ng ntun jauu
St to nbaint ontet dauyt Lodhin ond-abstsat C0)
Bibuween clauey enkundy
and abstwocd muhod. mthod
Bukwaun ot as entend
t can onkaln ntainto tai on_ Buwen clau and lduoce m plumt
| Vasi oblu allo Vasialolu
Abstrad dou tan entend Intw oku Lon endends mo
|0nly one doy than onu iniotn. clauAtends enlund
A he ostnod methods Alhe obstaad method o
lol the sbstmoat tau should nwae should ba
endend anplemetu
| em plamudad In y n muinetad ini 9t tmplunmerdatan
elauc clau
Subdame clauea.
Abstnot dauu tan Implumud An. tdtn ace: Cannipt
sturas nplenend anbthn 1toc
JAIHIND GROUP OF INSTITUTIONS
Name -Class Roll No.

Subject Topic Date

A
Ma-Thraa.dedOgama
mplemui c ktndend
clau ewkend tndunoce

ntace turoce L.Midion the watmplunurtiug mut1 thsading tn


A
8te Aaderoce Jawa. 201)
mplementa mplemut Thriad Can sbe Crt atd 90 wo wauf

entend ednds
mplamunt B C By endendinq the awa Lang. Trad das.
By implumauing the fawa. ang.Rurnoble tvtua
clay
Metion any u trmad mthods
Remnu 4ntance ol ewmen muuning tread
Curd ThTead ) : an

name auignd a thu thmed.


irg endend ujsond we popotiu ol on ttrui atNamesr : Rehun
anow ttrul and uing lang lenetus1ywond la Exeuty tu body othe tmtad.
p+ovide bodiu untion onn dition ude a slrukune RdNamel. e he Nane Hhetwtad
In cimpla, ankund meann gtug and m plemui maony
Explain hu a Thread

An nto ac Conu Contai. alostrat muthod and


tnol vaniabla
dead
Tun

tout the

thrLad not eady to -qun

Claeptn oazing bloKad)


Whan Stasd)mhed talled, ad lwy In
aenduy tor un atata Tr4 thmad non pool o
|read rmady 1"jor he eme uution. Sondi ma lalx the motad
pfued U by the shadwou fr xe ution and mored
stata.
Th thrtad ddulcm may more he thstad ot o 4he
Ee9090 JAIHIND GROUP OF INSTITUTIONSS
Name Class Roll No.-
Subject -Topic Date

h e unning stale 14 hax nolnishd u


even
oting: Sodimu a thrad might waA,fut betawe
xeion we have aaKed to
t wait (Lollln he awalag
0lojuwt'h wonik1mlhed n ts n method. nihat
aeadylo Tun stat (Ruwnalble)
Aorrad n dhe a dy to Tun atata when 94
A uhnad ehavgu dada romsunning to
wotng T thsiad imain tn h and1
lgf lela o run, lbut e eha dulor shanot ipruke d
CLoththisad Sund a notificaionhd no ong
autually qun A Brad can oluo rdwun to raody.
4o-Tun stola h r
netenay oa he thruad o u a
altrurina0 atu he not -

Tad.
u n s4ae
Stotxed Som simu a hrad nuds to wait ou a
.Calkihe tat) mhodO vy onu'on a thre ad
obfut n vokinga stosd neho d on theod 9tixouwewil runnkng Fo ndant, 9 adina
obfut he nkworn owue n t Tun mehod,
#had alrtadusdud u ago Ma o walt wdil -h d r t o w betomu awailabk
UntL hot tme he haad cannot do muh and
b unninga: wtu t
Whl the hsLad t u n not Tall Tuning Thereo moya ouk o
tate te JVM s4ud and n k u bloned stah Whun he
to xwa he hTad'a un) mhod. 9uuruntng stata
Thi thtad runainu Jo Loudh lolotked bomneu available,
n stade and *ep surninq he thread again buomu ligible t axeude and hune
Aa ppd Dud by tad sehelen bn
-
?4 vo luntaxa to rLdy lo- Tun tate .
gtve op t oun dsones ntao.
d)rad state
C)Not 72ad to Tu LBloxed stata) awa twiad eu a ate ohen 4 haindshed
4
A Tad movu Duk o u Tunning sta hen ?t& uud on t s u n method We Cavnot stauut h e
wosting happenAlb the wundo toraad onte dead. Te tad tan be stadad ondy
w aitin hapona, he mad
-
mo vu baek once n ectime we Te ênvoxe stant C) on a

Taady a -

vun s4ate. 4hread drith t dead, 4 dou no staded aqain


We cen ttut hether the thread olb ed u oiyYe o dead

slaapia
some tim In ocae, Lo
We mau wanta hradto do- nohing lo
can tall he Thead.Aleep t)
by nvoi h Alarel) mdthad 0n

mehod n ne Hhnuad' un l nmthod. K method 4Exploin with an x arnple e nplemed aton a lHre ading
tils u unertly "uanlng thvead to Manp o Some enrendng Thna d dau.
Pe-s90d oime. Thethrmad twaku upr when e
Rltpulatad time uelapsd and 94goe Dak w e Step taa a clau hat ekends Thmad ela. The irttad
o Tun stau.
daur upasd jwa. lang pockag and hane no nead to
mpovt x plidtl
JAIHIND GROUP OF INSTITUTIONS
Name. Class Roll No.

Subject Topic Date

Slep Ovsodde publc Votd run )mhod nuile he da Pub ic ca Thrtod Demo
p a wle?Beh legit oe Tun Ch mthod Runember he
to de
nui de un L) oi bexeadedoly b n ad pulobc stodic vofd onain (sting ang L)
Shp4: W t anotmex cdau to ctote ithrtad andr to

nitrate e weudion othviad Systun out prlaktn "Main Thetod Stvded *);
Sp Lnide matn , a t a an obtet 1Myhnad clau, MyTsead ob nu MyTheiadl
Ao hat tthe unta method. ovailable e Therea d t i nuo Thrad lobi);
Stp Now, Cwtas a thread and atah e taad to the
obwt bbf. Sugtua ouk prhtin (*Main Thead Con pldad ");
Skp To un he adywe sold allshat
ahodThe diy o tawe) method t o handovon e
gun.C1 mhod puot n th objut onah Hhe stank(
muthed u callad to bcal operoi v s r 5. Wo?t a po0qvan to tnpumet hrad paioitiu. (101)
sheduing
lan ThrreadA dedund Thread
Mha d n tad objut, run itho d found
4 wi ull Bha statemetu aide hod Tun () public vofd rwn
metnod 9
or Prd f-1 ferto, f+)
A
Suxtuo.oud printin (hrad. wned Thriad t).autwame)
clas MyThrad xtend Thrmod: o ti 2
Surtun: Dut prinkin End Thvad 0ne ");
puoke votdiun s

Systum Dut potntin Funtistavded ; s C

lasu Shnad 8 tud Thrad


Sytum.oud prinkn. " The rolu u 1
puolic vOd nun )

Sustun. o pr?rd in sun ) tom plued");


o Ctad 1: 11 fe 20 14)

1 r tem-out pvinln (Thad. CuwountThread ().


qutadame t) "="t);
JAIHIND GROUP OF INSTITUTIONS
Class Roll No.-
Name
Subjoct Topic- Date

hstad Swo') )By dnding -th jawa Larg.Thuad dam


Syrtem Dd prtnd n CEnd o
The cimplut way to dehine ode to run n asps ale
haad to Etund uawo. lang. Tread dan and
Ovolde he nun muho d

cdaus Tntad Paio iy


cla MyThread entend Thread t)

publc atati c vod main CStotro aaaL3)


puublic Vofd Tun (

ThtodA ba nuw Thead A L)


lob unnlnq tn
hread 1 = no Thad lta, Thead One") Sytm.ok.prlnt in C" Imponlant
Sot Psto ity lio) A riad "}

Thrtad B t nu Trad B U)
Thatad t2 - nuo hnad bb,hotad Too"),
aw aHhrea da. Pa awa Th
Tne un) muthod tort

9tir
Mtod ety pof t and eit po?nt t an fhed
EL. Staat 7 WeTtat

ta. stawd C1 rs o Tntde unt), wa wl wth tne code #hat tairnd o


be Meutad by nw hrrad. The Tun () tablishe

t y pot ox ohn, ton cun ud


an ad
wtun ow proq7am. Thi thread wiend when runl? nchod

wtte te stept nvolvad nvtati nq thvad by u Complated.


Pnplemedinq runabe tura The imitaion th is pproash t hd we extend
wkend than
Siad we Cant eakend authbng ale
mo

Whad bne cla n Jawa


head Diuus tna anio wu a na
th ad fn awa he advantoj appsoaeh u hak, we can diretu
make uue h mthok tn mad

A thad and a prgvam tha wwna A


h nad ya
tno taqpedial oo tconto Atin a Ran glemerting th jawa lang Runnab tta
Prot. A tMnad auo rewnnd a aiqu-wfa
l e can crtde #hrtad b nplumuding Runnable fiduot
The Rurnalol
telaxJoua ha the followina Spltcaio,
Canprittrg Ona abitaot muthad dlaration :
JAIHIND GROUP OF INSTITUTIONS

Name -
Class Roll No.

Topic Date.
Subject

puolic rter ate Runable t ) whd u cyndrorielion oky do we nttd cyndhognition


n Tawa? 2021)
u he
public vo?d runt The Synchaainlzation ocu oawo?ding
ulki ole ads t aut 0n e tame data osa metho d

con cTate clau hod m plamerduarnable 9 a t . The most comnan alon ynhanonigdson. u wu
awo ot move thmad ned aeu to a shaed ruowc
l a My Runnabls enplerneta wnake Lan be ed by owly ona tmad at a time

Pubkc vofd nunl)

Stum ou n t n hrtad wil exeute hi code 7;

A 4nad, whidh u caeatdbatd on ha 0buh 1tha


Rmplumd heRunalble v a e , twill roda ihe code
de ned tn bhe pulolic mhod run() t 'an et
an e potd or4hnadA treadu ondr uohn the
un method end1

u cla u als lasy enkendea ano then dauhen sb


wa can m plemet Runab li 9oe. 93

da MyRunnable enk ends My las Implarrutar Rurnoble

it publie wOd rnt )

Sytun.oud pottln ° Thrad w be eretuad ");

You might also like