— Scott McNealy, Sun Microsystems Chairman, President and ceo


part is, it happens automatically!



Download 40,57 Mb.
Pdf ko'rish
bet402/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   398   399   400   401   402   403   404   405   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)


part is, it happens automatically!
Dog
foof
Dog
barf
C
oll
a

ob
jec
t
S
t
rin
g
o
bjec

Do
g[

a
rr
a
y
o
b
j
e
c
t
int
String
name
Collar
col
D
o

o
b
j
ect
size
“Fido”
C
oll
a

ob
jec
t
S
t
rin
g
o
bjec

int
String
name
Collar
col
D
o

o
b
j
ect
size
“Spike”
This Kennel object has a reference to a Dog [] array object. The 
Dog [] holds references to two Dog objects. Each Dog object holds 
a reference to a String and a Collar object. The String objects 
have a collection of characters and the Collar objects have an int.
When you save the Kennel, all of this is saved!
Ken
n
e
l
obj
e
c
t
Dog [ ]
dogs
Serialization saves the 
entire 
object graph

All objects referenced 
by instance variables, 
starting with the 
object being serialized.
serialized 
objects
Everything has to 
be saved in order to 
restore the 
Kennel back 
to this state. 


serialization 
and
file I/O
you are here
4
437
If you want your class to be serializable, 
implement 
Serializable
The Serializable interface is known as a marker or tag interface, 
because the interface doesn’t have any methods to implement. Its 
sole purpose is to announce that the class implementing it is, well, 
serializable. In other words, objects of that type are saveable through 
the serialization mechanism. If any superclass of a class is serializable, 
the subclass is automatically serializable even if the subclass doesn’t 
explicitly declare implements Serializable. (This is how interfaces always 
work. If your superclass “IS-A” Serializable, you are too).

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   398   399   400   401   402   403   404   405   ...   555




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish