1 . W h i ch o f th e f o l l ow i n g e x p r e s s i on s mu s t b e
tr u e i f yo u c r e a te a t h r e ad u s i n g T h r e a d = n e w T h
r e ad ( o b j e c t) ? ( a) o b j e c t i n s t an c e of A p p l
e t ( b ) o b j e c t i n s t an c e of Ru n n a b l e ( c ) o b j e
c t i n s t an c e of Fr a m e ( d ) o b j e c t i n s t an c e of T h
r e a d 2 . S u p p o s e t h e r e ar e t h r e e Ru n n a b
l e t a s k s , t as k 1 , t as k 2 , t as k 3 . H ow do yo u...
Monday, April 16, 2012


1 . A n a l yz e t h e f ol l ow i n g c o d e : p u b l i c c l as s
Te s t i m p l e m e nt s Ru n n a b l e { p u b l i c s t at i c vo i
d m a i n (S t r i n g[ ] a r gs ) { T h r e a d t = n e w T h r e a d
(t h i s ) ; t . s t ar t ( ) ; } p u b l i c vo i d r u n ( ) { S y
s t e m . o u t. p r i nt l n (“ t e s t ” ); } } ( a) T h e p
ro g ra m d o e s n o t c om p i l e b e c au s e t h i s c an n o t b e
re f e r e n c e d i n a s t a ti c m e t h o d . ( b ) T h e...


1 . A n a l yz e t h e f ol l ow i n g c o d e : p u b l i c c l as s
Te s t i m p l e m e nt s Ru n n a b l e { p u b l i c s t at i c vo i
d m a i n (S t r i n g[ ] a r gs ) { T h r e a d t = n e w T h r e a d
(t h i s ) ; t . s t ar t ( ) ; } p u b l i c vo i d r u n ( ) { S y
s t e m . o u t. p r i nt l n (“ t e s t ” ); } }
( a) R u nt i m e E r ro r
( b ) T h e p ro g ra m d o e s n o t c om p i l e b e c au s e t h i s
c an n o t b e re f e r e n c e d i n a s t a ti...


1 . The following method in the Thread class is not deprecated : ( a) y i e l d ( ) ( b ) s u s p e n d ( ); ( c ) r e s u m e ( ) ; ( d ) s t o p () ; 2 . W h i ch o f th e f o l l ow i n g m e t h o d i s a s t at i c i n j ava . l an g . T h r e a d ? ( a) s l e e p (l o n g) ( b ) r u n ( ) ( c ) s t a rt ( ) ( d ) j o i n ( ) 3 . W h i ch o f th e f o l l ow i n g s t a t e m e nt i s f al s e ? (
a) O n c e yo u i nvo ke t h e awai t m e t h o d o n a c on d i t i...


1 . W h i ch o f th e f o l l ow i n g s t a t e m e nt i s n o t d e
fi n e d i n t h e Ob j e c t c l a s s ? ( a) wa i t( ) ( b ) n o
ti f y( ) ( c ) n o ti f yA l l ( ) ( d ) s l e e p (l o n g m i l l
i s e c o n d s ) 2 . W h i ch o f th e f o l l ow i n g m e t
h o d i s a s t at i c i n j ava . l an g . T h r e a d ? ( a) s l e e
p (l o n g) ( b ) s t a rt ( ) ( c ) r u n ( ) ( d ) j o i n ( )
3 . Yo u c an n o t c r e a te a b l o ck i ng q u e u e u s i
n g...


1 . W hy d o e s th e f o l l ow i n g c l a s s h ave a s ynt ax e r
ro r ? i m p o r t j ava. a p p l e t . *; p u b l i c c l as s Te s t
e x t e n d s A p p l e t i m p l e m e nt s Ru n n a b l e { p u b l
i c vo i d i n i t ( ) t h row s I nte rr u p t e d E x c e p t i o n {
T h r e a d t = n e w T h r e a d (t h i s ) ; t . s l e e p ( 1 00
0) ; } p u b l i c s y n ch r o n i z e d vo i d r u n ( ) { } }
( a) Yo u c an n o t p u t t h e ke y wor d s y n ch ro n i z e...


1 . A n a l yz e t h e f ol l ow i n g c o d e : p u b l i c c l as s Te s t i m p l e m e nt s Ru n n a b l e { p u b l i c s t at i c vo i d m a i n (S t r i n g[ ] a r gs ) { T h r e a d t = n e w T h r e a d (t h i s ) ; t . s t ar t ( ) ; } p u b l i c vo i d r u n ( ) { S y s t e m . o u t. p r i nt l n (“ t e s t ” ); } } ( a) T h e p ro g ra m c om p i l e s fi n e , b u t i t d o e s n o t p r i nt any t h i n g b e c a u s e t d o e s n o t i nvo ke t h e ru n ( )...
Subscribe to:
Posts (Atom)