Effective Java



Download 2,19 Mb.
Pdf ko'rish
bet259/341
Sana11.07.2022
Hajmi2,19 Mb.
#776765
1   ...   255   256   257   258   259   260   261   262   ...   341
Bog'liq
Effective Java



CHAPTER 9
GENERAL PROGRAMMING
290
can be made in favor of capitalizing only the first letter: even if multiple acronyms
occur back-to-back, you can still tell where one word starts and the next word
ends. Which class name would you rather see, 
HTTPURL
or 
HttpUrl

Method and field names follow the same typographical conventions as class
and interface names, except that the first letter of a method or field name should
be lowercase, for example, 
remove
or 
ensureCapacity
. If an acronym occurs as
the first word of a method or field name, it should be lowercase.
The sole exception to the previous rule concerns “constant fields,” whose
names should consist of one or more uppercase words separated by the underscore
character, for example, 
VALUES
or 
NEGATIVE_INFINITY
. A constant field is a static
final field whose value is immutable. If a static final field has a primitive type or
an immutable reference type (Item 17), then it is a constant field. For example,
enum constants are constant fields. If a static final field has a mutable reference
type, it can still be a constant field if the referenced object is immutable. Note that
constant fields constitute the 
only
recommended use of underscores.
Local variable names have similar typographical naming conventions to mem-
ber names, except that abbreviations are permitted, as are individual characters
and short sequences of characters whose meaning depends on the context in which
they occur, for example, 
i

denom

houseNum
. Input parameters are a special kind
of local variable. They should be named much more carefully than ordinary local
variables, as their names are an integral part of their method’s documentation.
Type parameter names usually consist of a single letter. Most commonly it is
one of these five: 
T
for an arbitrary type, 
E
for the element type of a collection, 
K
and 
V
for the key and value types of a map, and 
X
for an exception. The return type
of a function is usually 
R
. A sequence of arbitrary types can be 
T

U

V
or 
T1

T2

T3
.
For quick reference, the following table shows examples of typographical
conventions.

Download 2,19 Mb.

Do'stlaringiz bilan baham:
1   ...   255   256   257   258   259   260   261   262   ...   341




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