— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet541/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   537   538   539   540   541   542   543   544   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

java.util.ArrayList
, JButton is really javax.swing.JButton, and 
Socket is really java.net.Socket. Notice that two of those classes, 
ArrayList and Socket, both have java as their “fi rst name”. 
In other words, the fi rst part of their fully-qualifi ed names 
is “java”. Think of a hierarchy when you think of package 
structures, and organize your classes accordingly. 
java
net
util
text
awt
event
101101 10 
1001 101 10 
10 10010 
101 101 
101 101 101 
101101 10 
1001 101 10 
10 10010 
101 101 
101 101 101 
Socket
ActionEvent
101101 10 
1001 101 10 
10 10010 
101 101 
101 101 101 
FlowLayout
101101 10 
1001 101 10 
10 10010 
101 101 
101 101 101 
ArrayList
101101 10 
1001 101 10 
10 10010 
101 101 
101 101 101 
NumberFormat
Package structure of the Java API for:
What does this picture look like to 
you? Doesn’t it look a whole lot like 
a directory hierarchy?
java.text.NumberFormat
java.util.ArrayList
java.awt.FlowLayout
java.awt.event.ActionEvent
java.net.Socket


588
 
chapter 17
Preventing package name conflicts
Putting your class in a package reduces the chances of naming 
conflicts with other classes, but what’s to stop two programmers 
from coming up with identical package names? In other words, 
what’s to stop two programmers, each with a class named Account, 
from putting the class in a package named shopping.customers? 
Both classes, in that case, would still have the same name:

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   537   538   539   540   541   542   543   544   ...   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