Vous êtes sur la page 1sur 190

{publi

c void
reloa
d();
}class
Edit
{publi
c void
Edit()
{}
}
interf
ace
Displ
ayabl
e
exten
ds
Reloa
dable
{publi
c void
displa
y();
}ques
tion
37
====
====
====
for(int
x : y)
quest
ion
49,33
5
====
====
====
===
(temp
=buff
Read
er.rea
dLine
())!
=null
(IOEx
cepti
on e){
quest
ion
12:
====
====
====
===
Alpha
:foo
Beta:f
oo
Beta:
bar
Beta:
bar
quest
ion
52
====
====
====
===
class
A has
name
A
class
B has
name
A
quest
ion
251,3
36
====
====
====
=
impor
t
java.i
o.*
public
class
Read
File{
public
static
void
main(
String
argv[]
){
try{
File
x1 =
new
File("
MyTe
xt.txt"
);
FileR
eader
x2 =
new
FileR
eader
(x1);
Buffe
redR
eader
x4 =
new
Buffe
redR
eader
(x2);
String
x3 =
null;
while(
(x3 =
x4.re
adLin
e()) !
=
null){
Syste
m.out
.printl
n(x3);
}x4.cl
ose();
}catc
h(Exc
eptio
n ex){
ex.pri
ntSta
ckTra
ce();
}}
}
quest
ion
329,1
51
====
====
====
====
run()
--->ja
va.la
ng.Th
read
wait()
--->ja
va.la
ng.O
bject
notify
()
--->ja
va.la
ng.O
bject
sleep
()
--->ja
va.la
ng.Th
read
start()
--->ja
va.la
ng.Th
read
join()
--->ja
va.la
ng.Th
read
Q200
,313
====
====
====
public
int
updat
e(int
quant
ity, int
adjus
t){
quant
ity=q
uantit
y+
adjus
t;
return
quant
ity;
}
public
void
callU
pdate
(){
int
quant
=100;
quant
=upd
ate(q
uant,
320);
syste
m.out
.printl
n("qu
ant="
+qua
nt;)
}Q-
308
====
====
====
=
public
class
Doubl
er {
public
static
int
doubl
eMe(i
nt h)
{retur
n h*2;
}
public
class
Holde
r{
int
amou
nt=10
;
public
void
doubl
eAmo
unt(a
moun
t);}
Q-
362
====
====
====
===
java.
util.S
orted
Set-
>>>>
>defi
nes
base
meth
ods fr
an
order
ed
set..
impor
t
java.
util.Ar
rays-
>>>>
>prov
ide
array
mani
pulati
on
utilitie
s..
impor
t
java.
util.It
erator
--
>>>>
>>def
ines
meth
ods fr
leniar
acces
s to a
collec
tion...
java.
util.Tr
eeSet
-
>>>>
> pro
vide
concr
ete
imple
ment
aion
of an
order
ed
set..
java.
util.C
ollecti
on-
>>>>
>defi
nes
base
meth
ods
for all
collec
tion
objec
t
Q
183
====
====
Scan
ner
scan
ner =
new
Scan
ner("
one,5
,true,
3,true
,6,7,f
alse")
;
scan
ner.u
seDel
imiter
(",");
while(
scan
ner.h
asNe
xt())
{if(sc
anner
.hasN
extBo
olean
())
{Syst
em.o
ut.pri
ntln(s
cann
er.ne
xtBoo
lean()
);
}else
{scan
ner.n
ext();
}Q-
188
====
====
java.
util.m
ap==
=>
defin
es
the
meth
od:
get(O
bject
key)
java.
util.S
et===
>
conta
ins
no
pair
of
elem
ents
e1
and
e2
such
that
e1.eq
uals?
(e2)
java.
util.Li
st===
>
allow
s
acces
s to
elem
ents
by
their
integ
er
index
java.
util.Q
ueue
===>
is
desig
ned
for
holdi
ng
elem
ents
prior
to
proce
ssing
Q-
199
====
====
T
exten
ds
Pet
TTTQ
-53
====
===
Car is
a
Vehic
le
and
Car is
a
Colla
ctabl
e===
>
class
A
imple
ment
s B,C
{}
Car
has a
Steeri
ngWh
eel==
=>
class
A {B
b;}
Car
has
Whee
ls===
>
class
A{ Lis
t<B>
b;}
Mini
is a
Car &
Car is
an
Objec
t===>
class
A
exten
ds
B{}