0 ratings0% found this document useful (0 votes) 23 views11 pagesJava Unit 3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
|
| uuit dE
= Wingo Clax to Favor’
Tt prowdes meehanis
ato primitive -
woe need to be
10 connest prim,
fnto object and —ebject
|
* Tava is an Cope Language vo
deal sith objects many time Be ond
| olata Nn
lx oh wvappey olay Lorapt oe st
gia {4 and object “appem4
type te fetered the objed
* wherever the olata
ax an obyct this object an be sued
25 Usesd_ey_ wrapper clans:
Jo comet simple date Type fro. object an
Nicenexseu :
| primitine Doda type Wappen clerrs
19% +o 198 —— byt@ =
3316340 32167 — Short : Short
- 84087 a Tabegen
si, 61 — lo In
fat “Moat Ps 7
clouble couble
ots 66536 - chan ‘ Chaxactey
14 lo - booLean Boolean,a ae
| thew a two ¢onversfon Fp, :
| r UY a4
@ eoto Borfng PPA eos 4
@® Unboxing.
uct Boxin
eT * he automatic conversion ty priredtiy
dato Aype Reto tre forverpending wrapper Clee
ts AMON as eictoBoving -
Public clase ox €
Ruble Stat?c Votd main CSting 3x43)
- %
fat a= a;
Tnteger |= a: M aoa Sdor
Tnckeoen f= oe Nalue Cf (a) 2
Sop ar “See eys
y ’
5 \ \ele= 2D 2 20 |
O} UnBovtng: etomecttc conversfon &} wrapper
ctype frcto primitive type,
RAKE proces oy vttoBoxi ng.
fublic clas et {
rublic Static votd: main (Ging org),
t
~ int a= gos
Takeger a > hew “Integer (30)'> «
ort f= a intlalue cy;
find | = @
e. Gop Can it
3 Pree ess
4
peeNubre clorws ‘Satnple
: )
EATEN CSI ones CY
ace Gs ) auto botfag
dwtegey j = a5
Sop Cas” ERA)?
St Y= jy —— ynboxhry
+y)s
Sop ca" "
if
y
| clenable Sorte — Terten face fo Jara !
clorable ds an Anten-tace hall wed to
| create enact fry of an object:
bp at exists to Javardang package
| ead dan must trnpltment the clonable intetfar
Gt you word to Coveate the clone” Ge “he
claw object
we clone method ui aed to couate an enact
copy tH the object=
+" toneNotsuprowedérception occu uober the
clos doedat implement the dlenabk ttevtace
= declasatfon «6 clonable TLedex
public clas 2 class name > tmplemenl clonabls
‘
protected object done (throws Clone Not Sagported
‘ “Exeep thon,
return Super Clone ()
'(
lk Stv?ngq name |
claw Depard nent tee 2 oN
t j
| tat dept:
\ tepartment (tt td, stying 9)
\ {Bhs ee
\ deptid= id, word difcplay
{ eee ; $c: pl dept id-+nam
clad Gtuclert fmplements lona ble
‘ int tlt
String name 5
Cuderl Cint i, string (departenest
t
fd=t: :
name = 1;
ys zd;
wed obi splay O
‘angi #nam) +
dept Aisplae)
teptbid object clone (thaws loretbtfouggeticttzertion
Bac super denel);
J i
Public clars Carnple
Socom C secing'o CD)
| : {gefegrent-depty = neun deve” 9
“auctenl ol = new Student C1, "Fao" ¢
Stu dank Ss = MecStuded) s- donel) 5a « dé&douyl) 5
¥
i
| Tr RPA
File
ieibg
= Tana: to ** We fnput
——_ Les Da
SA ds wrtd to pro
produce the output
(
Jana wes ty concept eS
Spat fouckart opevatfors dart”
ssStneami.q, it a &
+ St la composea
+ So joa adhe §“a (ther tp ODA FNP AMEDD nt, pions
Stovean Buffered. 1 |p stream die
fushback Tp stereo
Kile ole = Byte anvay=
Mond, elo CO Gt ds wired vtlo Ghpse tbe {ay O
lp Chneany:
fenport Java fos
Clave ftleolerng
Cruuite slalte’ \otd thet Cottng ov ET)
‘aah g + few Starner Csystemtoy
styfog, NG \ ae a
Sop Couey toe sting")
Sle Einentbtne (5
byte bid seget fyte C) a
S10°p Ch denoyth)
Areoulpulstvearh +
Ce] io
tov (int Jror, feb 1
shud
S10 + pur fat inno ote
poeen Salley
. aes (12 tag kun.. $e ob
“bite alaI ovaflable ¢)—s ot.
‘avtat (able
ot
positon
® sktp()—s ie
Barer,
© dose) > :
* apn «
@ mark O>
ton port SoXlarion®s
public dors ¥ledare |
u
Public Static void
> Vata :
fe iy weal “fo wiite
to tre output ctring«
A G{ ws wnt ‘tiem
to th 4ileFileInput trea ty = pen
Porta npdstrean gy = new
int a = do read Tne
double 4= 42+ xtod D
une c= das oxo:
Soe C14* “le ce
i
5
a
onto Cutpecl Stowam dt = ew |
oly wovFte Dat C68) "+ a
di+ wyfe Double C23)5
oll wyttechaa Ce 4
aa
chor stream
w T wy dota Sip eeu” -to ‘aead arta, cha,
Le] dorm te tile
i
Tenport jena ion #5 ‘ le =
| |
eg claws ad
“ubtte latte wofd mash esuing — Cs
t a !
HtleOuclput Hearn 4 = ree FileOe ‘cho. Stowam : ’
Byte ctyram a seal
cp operation, &% R Bin Buk
a chas Gtyeam ix wired
cptiation mr 16 Bits
4 chosactey ctyeam clones
eto choaacte, 10M
written to destinatt
| Ted
® Reader claw
| @® covitter caw -
afte wbttten ¢ It as
Se
| writting, chara Leer’
| * In Byte Shrkam”
| aing into Bitte
dectly urbe six
= fe Reades Claws *
ot us wed +o
Mmport {aNasio-* 5
fublic claw Sample
{
Fubl?c Statte vor matin C Sting anys C2)
‘awortter Ay = now) File uote C's fray |
is pols).
fb write (1 @E- GE CRAY) 5 if
40 doselS;
atfile Reader fy = new ft a
Gree At
while CC t= $2-yeades) } = =
€ esoepCcthendf)
i
4 lose) 5
7
S