— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet272/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   268   269   270   271   272   273   274   275   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)


particular method.
 BULLET POINTS
ß

static method should be called using the class
name rather than an object reference variable: 
Math.random()
vs. 
myFoo.go()
ß
A static method can be invoked without any instances 
of the method’s class on the heap.
ß
A static method is good for a utility method that does 
not (and will never) depend on a particular instance 
variable value.
ß
A static method is not associated with a particular 
instance—only the class—so it cannot access any 
instance variable values of its class. It wouldn’t know 
which instance’s values to use.
ß
A static method cannot access a non-static method, 
since non-static methods are usually associated with 
instance variable state.
ß
If you have a class with only static methods, and you 
do not want the class to be instantiated, you can mark 
the constructor private.
ß

static variable is a variable shared by all members 
of a given class. There is only one copy of a static 
variable in a class, rather than one copy per each 
individual instance for instance variables.
ß
A static method can access a static variable.
ß
To make a constant in Java, mark a variable as both 
static and final.
ß
A final static variable must be assigned a value either 
at the time it is declared, or in a static initializer. 
static {
DOG_CODE = 420; 
}
ß
The naming convention for constants (final static 
variables) is to make the name all uppercase.
ß
A final variable value cannot be changed once it has 
been assigned.
ß
Assigning a value to a final instance variable must be 
either at the time it is declared, or in the constructor.
ß
A final method cannot be overridden.
ß
A final class cannot be extended (subclassed).

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   268   269   270   271   272   273   274   275   ...   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