— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet296/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   292   293   294   295   296   297   298   299   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

numbers 
and
statics
you are here
4
313
Exercise Solutions
StaticSuper
( ) 
{
System.out.println(
“super constructor”);
}
File Edit Window Help Cling
%java StaticTests
super static block
static block 3
in main
super constructor
constructor
Possible Output
BE the compiler
StaticSuper is a constructor, and must 
have ( ) in its signature. Notice that as 
the output below demonstrates, the static 
blocks for both classes run before either 
of the constructors run.
1. To use the Math class, the first step is to 
make an instance of it.
2. You can mark a constructor with the key-
word ‘static’.
3. Static methods don’t have access to an 
object’s instance variables.
4. It is good practice to call a static method 
using a reference variable.
5. Static variables could be used to count the 
instances of a class.
6. Constructors are called before static vari-
ables are initialized.
7. MAX_SIZE would be a good name for a 
static final variable.
8. A static initializer block runs before a class’s 
constructor runs.
9. If a class is marked final, all of its methods 
must be marked final.
10. A final method can only be overridden if 
its class is extended.
11. There is no wrapper class for boolean 
primitives.
12. A wrapper is used when you want to treat a 
primitive like an object.
13. The parseXxx methods always return a 
String.
14. Formatting classes (which are decoupled 
from I/O), are in the java.format package.
False
False
True
False
True
False
True
True

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   292   293   294   295   296   297   298   299   ...   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