Professional Documents
Culture Documents
ioat
O-03-22
bubli'e
int ag3(J =
Fo0,200, 3o0
= hew
ínt ag4(J itJSU, 12, 13, 14,1sG:
Stg
+ avtt 2: Jength) 4
Jengh
Syso( an3 dergth
Syso ( atst 4 Jeñgth an94 Jergth)
ls
S yso( Sthy length D)
Syso (4 )
d at 0 25 0
pinting
35
qrTL[3] : 35
data at
4th
jnden pegitin
Date
Page
Sygo (
Retiving the icata fom
eachoop
fos4 (int data )
Pzrint
Sy&5data +t );
Syso ();
Void moin
public. Staic (Sting. CI algs)
ne) Clasg A
(0 methi()
Joutput&
rsae
Coe
Aancad
clssMate
Date
Page
þackage Com
packi.
jawa: ute Anoys
Smpost sconne
Jawa util
Void meth)
Sconnet [Sysiem in);
Scann hew
many tHckets you heed ?
Sbing nane
[J
=
heus Sing ( Sc
-hetrt ()):
Sysa ( yo
heed" +hames Jehgth
+
tiket}:
Syso( Please ehtey ) +nanes. lengtth +"aon
syzo
Cugol
l Dake. potesnt in Anay ==)¥harg
ata Present
in Anay* Ay to
Syso0*
syso
(" Reketiving he deta ay using fo eah
o
sting. data'nome3)
Syo( data t
Syso ();
cassmate
Date
Page
on
L_zeseiving. the lagt One olement
Of tha
He
=2
is
f (name dengh >=2)
else
Sy8o(==+ nameg (nameg dengthL3);
Qutput
classmt
Dale
Pane
dangh 2 3 4
irden 2 4
Length 2
3
4
jhden oi 2 3
Jength 2 3
3oo
= $l00, 2.00, 300 asl3 lod200
d
a3[1
inden 1 2
lDelaßoh3.- t8
colects oNy honoguheaus daao
3hete No
final aotiable
jable s wled to
hch
get the Jehgih of
En- asbl Jahgth
cdassmate
Dale
Page
ongth a
C)a- is finalmelhedShich is ual to
qet she Jength of Stings
keypaindk in
oßject
Aheime of Agay
Agay
Dedatatione shauld
Decdatativn not
speeiky he Bizeo
hetsE tdete getting
cenptteine-etBt}y of
wald
a
int Valid•
need to
to pacif the Ugize othel cwige
otheoigeeoil
e
getig compile
e os of ah Arue
(ah foalso Jength
any data înto
into the
the Aoa1
Cant pols data
(viN
we Cah uje int, byde.,
sht chat datatyjas
a Jogth an
classmate
Date
Page
is an ndened
Of numa
colection fied
hontogenaus dat elements
humbe L2 |3
iii
poo
The. mmin.
O
go tot
multiple Value. the Same. hame
Xeadabilchy of
of the
he ode.
mean Wecrealed
Ohce thteis sizeho
chance. of
inctpheurenst
încsO ing Jecsealthg he
bsed oh
That jstoule
n
We should Rize aduahce thilh
not posgikle. shnauaygo
classmate
Date
Page
Hou do dedoole.
-To dedate an
followd
BstackeL1
follouwed
by'the idenifet Name o
C
At he ime of dedotatoh.
ca't speiky the
Size of
ibct [s1valid
/valice
()t r
So valid 4
intTI 0NLnm Ba!
=
$lo, 20, 30,40,
Psay size -5
=5
indiies 4
the Jongth of
pockaye com:pot
obditioh fal t
I/Shen Loop Hesirated
1/ inne oop
/* reoth
to oule
agaih Same But
Qutput 2
4 S
inden 2
den 2 3
0,0) (o1) (o,2)
4
T,2)
2.
2,0) (2,1) (2,2)
|Poactice
Pint Paintn Page
Void metht()
Syso(Java
Sygo
s ):
aesone )?,
Syo Pbint (
Sygo (love g))?
Syo
Sy3o (Saya is oet ientel )
Jaua is oBjedt
(pint
(C
(Ie
Dagicat arn classmate
Date
/* Giveh
Or,Int CoAaJegth 3, f thote 2
in
is
he Smidiate folloe 3, chohge the ekekt 3ta
hethi()
t 994J= $3,23
fuy (int f=0 i<a9 legth 1it+) Encpto
Jeng
3
if ( aC]-2
3 Li)= =3)
C
clAsSMate
Date
Page
Prgelos Com-packt
paskoge
public
tho
of fndegtretwh
elermen
of the
the. a9ts\ ay Jengh is e33
enizts
han 2ar
the elemens that gehn o
a Jangth
So, o?
meh3 (id IcGH)L 40, 60,
2)
if (as Jength=
gehsen
elle if (o. Jorglh = 1)
getwn att [o]
elie
o
etsh
(40+6°)
classmAte
Dat
5-09-22
Page
tatu
clAssmate
Date
Page
of s, detwn te if4
Jength o9 aud
element last element ate
oongs
publis statit blcl
bid main (Gting. L]
Ouput
classmate
Date
Page
public Static
=
clasgA hew CkasgA)i
= 3
boodean reult anbj- ComnohErcl ('nput, inpt2)
classmate
Date
Page
public. JaggClo3A
enbl'c.
stt
claggp hob' = neo Clogs Al
4
=
int sezut asbj sum3( inpu) t
23
classmate
Date
Page
package.
2 t
3 etun a hew atooy
Jangh 2 condainind
hir iddle ekmorts
t/
public.
ntrJ middlauay
(intiJa, înt[]b)
=
ClassA aobj ClagA)
t
mput 2
-I=
lo,20,30
TSult = aobj middieulay Çinpud d, input 2) 33
o! it data eut)
+
data )l6 2o
20
utput
a-8
Date
Page
pakae Compacki
ClagA
þullic. dass
he atS
* givern. nt agAQ., etBn
he .hle
utht olouble eh the axinal
element the
elemcts
ahd all the
int
length]3
at
Vai iag
ulic statico
lasA ank heo clagA
( it dta. yegut )
(data t )3L000,0,0
otpt
Bfeet We assmate
Once st
We ceated. we
want 6-08-20
canhot o Bjeet
odify tasy
Prsgln
Rublic Clasn
Voicd nheHd0
String s = Java
Joaua ")
Sring 62 = hew Sting (
chaot cotottJ= §Ja',va
Sbing s3
= nes Sting (a);
2
Sti ( aA, 2, 2)3
nden
Pusition
Syo(S "+ s);
Syo ( S2 + S2)
Syso ( s3 3) + $3 ):
S4
C)
Void eth
Output
S2Jova
S4 Va aV
id
pLO)isi
lassMate
Date
Page
Sig si=Tava
=
Shing $2 hew Stig (" Jaua)3Il Java
inden 3
Shing S= Java
Hoap Memcay
752
Java
Shig S= Casei
S= re)
Sti Shing
(Je) Casg.2
Si sthas
d
Stine s=Jaua
Jawa
Gtring. s2 : Jaua le SCP 53 |Stang sshew Striyl"Jave'
(Tava)
Sting s3=Htr)i14SD Sting se = heus String(Ox3c.
Html)
8=0Tode" (osuk
(4
A
Uhdaclandig tbrnding -i Sthieg eslespts
Shing Shig
Str Helo J.
Cseate
()l We
Can
Kome
stig
with
Stig St
he Srig ("Jaw);
we
Create chataetet
chat
cdassmate
Date
Page
(seak
a
s2= hew Sting. (saol)
hee
shjh chaydes
s3=new sbing o4 2, 8)
2nd chactade a total of
Hete atingfom
asle
s= he)
Shig 6= Shing(Jn);
Then twp objeds. wl Be csealel
congtoat poal
the otho Ohe
sShing
SCP)
a n te folloang.
t we Coe Csahg Shig
yava ))
Shing S= sco
Then objetwill Be Creaked in
ohe
ahd s) that ojt.
4 eristing.
oet not alcad thee then ody
objed
il te
be Csaedo Hehe theste is no
thaze, Rs
ro chare of dpliok cheuk
classMAte
Date
Page
evet new
A hen we
ote using opolaost Comjule
n
he
oitBe (eako the.
Heap
utilizahoh.
&avotal zefotehces
Dad,anbga of pohg
, e
do the sameobjet if
chenge the Valye
ofohe sefetence
Kefences pointirg to that obje will Be xefleted
casg methods-
Sig
Smpit fava- uttl-Scahn
eblic. ClassA
metht()
-
-")3
Jengh Vajabe
Jaglhc
Syso(" Jongh03
asegome.
Sygo( (C Concat () + st-lohcatts
13 ha -2 Spae
51); /Jaya
Syso(
Syso (
oi.4
chat)Dt S: cRaAt(3); a ttrce)
you
Syso( Peose endet gedet me):
Sting, dat, = SC-hert(
cha ghdeg data chaAt(o)
Swieh( gehde)
Sgso(UBet S
Male)
Case F':
eak
default a
Syso(SInvatd input)°
boteak
Dete
Page
Sysoto\owestCage (): ))
st
t&) Joua imutable:
lass is
(epace ().+
t sebloce(cqA)3| JAvA
Syo ("á1)ts1); Jave (stainge
Stings6 =Hello Word - spaxe.
Sygo So sb Jengh (l)13
cé( tm (3 "ss. taim ()
2
Jenght (0)3Il11.
SpoLe fom
Start anl and hst middle
Melhods Degcripio
begin
the subtaing
Retwths from
ing subgting (int Begib)
Bnden to encl. of the stig.
subthing fom
stng subzthig(itbegin, int osd) Ratuns the. to
egin îalen ehd-1 irde
uged o remoue
This method is
Sting tim ()
bankspaces p|eent at
of the
beginbig and ed
but nat blank Spaces
|Stig
Preset at middle of
te
theSpeifedchajatet is
if
aWailable -
hot then etwh
fnt lagrden Of(Chey ca) setusn Tnden of Oost ocaeehe
of the Speeified dhast aete
Oato
/9 /22•
Page No
{Shialal
þackoge
woid mehi
U
=
Sting dae ((
8/sep| 2022)
1 =
Sting asI3 dale-split(",2)
Syoc a1 ===)+ hrayg. to Sbing (at93))
syso ( -
((
Shing S- ABCDEF
Sygol
Reteivhg the dat fwm Byk daday
fot (
bte ar+)
Date
Page No.
Shivalal
syso(n + « »)
+
Voidl
public Statit
GlassAO: meth1()
heuw
Date
Page No.
(S/ivalal)
gpeeing of the
ClassA claegA
Shing elult
= aobj elloname (Jaua)
Syso (3egut) HeloTawa
ByeHi
þublic static
classA aob
=
hes clasAc)
==
anbi: (CH
make.Abba hb
Stingegult
xesult
Syto( xesu4) IL HiBye ByeHi
Void meth
i (Shing 3)
?S a palindgoe
Date
/
Page tio
(Shivalal
iven out sting ength
4, sueh ag
as
Quet ahd.
a. cod xetuh he stirg. uhete te wcGd is
n the midd le. Of the.
veid main
publicsttic
ClaseA acbj= new classA)
<
Syso (Yelt )9| Java>>
Void methi()
S: Concat (
Sawome
S=St Cohcat( is welome )
/
buffesid qhehd (is awelome ")
Void melth(
S1=
Staing.S1 hew Sting ("Jou ");
Sbing B4fey hyfet= hew
Sting Builde buitdeti : hew)
Staing
s2= heuw Sting. (Te ");
new
StiaBuildoi buildeg 2 Štbg Buitka(Jeun");
Date
Page No.
{Shivalal
shing uddot
Compazing Sbig
Stirg clagisteguols
clags (sa));/Taie
cJass y = =
Syco ( sting Bidde (buildott buildet2j) l(false
Ho
to hek the contenk eent neide Stoing Buffet
(Ot) Shing Builde.
Conpag====);
so Sygo
The content of ShirgByffe ==),
buffeoti to Sthingl) equala (bufleon 2-t String ())}
(2
mehe(R
L
Date
1o /9/222
Page No.
Shivalal )
VS VS Shigbuildle
Stirg3
StaugDuffot Shirguilky
com paski
public
Void meth i
sh=
sb= heu)
hew Gtbingßuffet0
singBffe
Sy30
3
sh apand( abcdefghijklmnap
Syeo
(" Jengths "t sb Jength6
Date
Page No.
Shivalal
Sb appehd(qr)w
Syso(sb +sb);.
theh
I| if Jengh is moHe Han Capoelty
=
(uopkit apily +1j*2 172.
syo(«
Syso ( -));
Syso ( chat At () "+ shchaciAt (sb- Jergth () -1);ilr
chaxAt ):+ Sb
sbo chot( sb: Jengthl-2)) I4
Syso( sb )tsB)°ni
Output
Date
Page tNo.
(5hitalal
eLommeded t
mutable, so they
Shing Buffe objeaks ale
iu
CGseak heu) opAk
((b||We cah
and pase the sbing to the oBjed, a:
ka Sting Buffe Sb= he Sting B4ffet (Sujctha)
stbingRufa is 16 ?
v The defaudt ritiad cataáty of
StitgBufe
a at
iD cho cHat(nt indenj
Retns chotacden Socated
Methods chsciçkon
oaing
Void sefchat Atttr Replace
te charotet
SPed'fed.inden wth the avide!
at
inden, cha ch)
chastactot
Page No.
(Shivalal
tSthingBuildea - wtl
te Baâng.
Same melhods as
of SbingDaffef exept the foltasng.
diffetencele
Page No.
Shivalal
Stin.
Stig is. immudable D
Aile StángBaffeo
ad Sthivg.
BuilosA