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 d i n t h e r u n ( ) m e t h o d .
( b ) T h e i n i t ( ) m e t h o d i s d e fi n e d i n t h e A p p l e t c l a s s , a n d i t i s ove r ri d d e n i n c o r r e c t l y b e c au s e i t c an n o t c l ai m e x c e p t i o n s i n th e s u b c l as s . ( c ) T h e s l e e p ( ) m e t h o d i s n o t i nvo ke d c o rr e c tl y ; i t s h ou l d b e i nvoke d as T h r e a d . s l e e p ( 10 0 0) . ( d ) T h e s l e e p ( ) m e t h o d s h ou l d b e p u t i n t h e t r y- c a tch b l o ck. T h i s i s t h e o n l y r e a s on f or th e c o m p i l at i o n f a i l u r e .
2 . H ow d o you c re at e a c as h e d t h r e ad p o ol ?
( a) E x e c u t o rS e rv i c e e x e c u t o r = E x e c u t o rs . n e w C a ch e d T h r e a d Po o l ( 1) ;
( b ) E x e c u t o rS e rv i c e e x e c u t o r = E x e c u t o rs . n e w C a ch e d T h r e a d Po o l ( 2) ;
( c ) E x e c u t o rS e rv i c e e x e c u t o r = E x e c u t o rs . n e w C a ch e d T h r e a d Po o l ( 3)
; ( d ) E x e c u t o rS e rv i c e e x e c u t o r = E x e c u t o rs . n e w C a ch e d T h r e a d Po o l ( );
3 . W h i ch m e t h o d o n a c o n d i t i on s h o u l d yo u i nvoke t o c a u s e s t h e c u r r e nt t h r e a d t o wai t u nti l t h e c o n d i ti o n i s s i g n al e d ?
( a) c o n d i t i on . awa i t ( ); ( b ) c o n d i t i on . wa i te d () ; ( c ) c o n d i t i on . wa i t( ) ; ( d ) c o n d i t i on . wa i ti n g ( ) ;
4 . W h i ch o f th e f o l l ow i n g m e t h o d s c an b e u s e d t o o bt a i n a p e rm i t f ro m a S e m ap h o re s ?
( a) a c q u i re () ( b ) a s k () ( c ) d e l e t e ( ) ( d ) g e t ()
5 . 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) Yo u u s e t h e ke y wo rd t h row s to d e c l ar e e x c e p t i on s i n t h e m e t h o d h e ad i n g . ( b ) I f a ch e cke d e x c e p ti o n o c c u rs i n a m e th o d , i t n e e d n ot t o b e e i t h e r c au g ht or d e c l a re d t o b e th r ow n f r o m t h e m e t h o d . ( c ) A m e th o d may d e c l a r e t o t h r ow mu l t i p l e e x c e p t i on s .
( d ) To th r ow a n e x c e p t i o n , u s e t h e ke y wo r d t h row .
6 . W h a t i s d i s p l aye d o n t h e c on s o l e w h e n r u n n i n g t h e f ol l ow i n g p ro g ra m ? c l a s s Te s t { p u b l i c s t at i c vo i d m a i n (S t r i n g[ ] ar g s ) { t r y { S y s t e m . o u t. p r i nt l n (“ We l c om e t o J ava ” ); i nt i = 0 ; i nt y = 2 /i ; S y s t e m . o u t. p r i nt l n (“ We l c om e t o J ava ” ); } c a t ch ( Ru nt i m e E x c e p t i o n e x ) { S y s t e m . o u t. p r i nt l n (“ We l c om e t o J ava ” ); } fi n a l l y { S y s t e m . o u t. p r i nt l n (“ E n d of t he b l o ck ”) ; } S y s t e m . o u t. p r i nt l n (“ E n d of t he b l o ck ”) ; } }
( a) T h e p r og ra m d i s p l ay s We l c o m e t o J ava two t i m e s f o l l owe d by E n d o f t h e b l o ck . ( b ) T h e p r og ra m d i s p l ay s We l c o m e t o J ava t h re e t i m e s f o ll owe d by E n d o f t h e b l o ck .
( c ) T h e p r og ra m d i s p l ay s We l c o m e t o J ava two t i m e s f o l l owe d by E n d o f t h e b l o ck two t i m e s .
( d ) Yo u c an n o t c a tch Ru nt i m e E x c e p t i o n e r r o rs .
7 . W h i ch o f th e f o l l ow i n g i s f a l s e ?
( a) u s e as s e r t i on s f o r ar g u m e nt ch e ck i n g i n p u b l i c m e t ho d s .
( b ) U s e as s e r t i on s t o re affi r m a s s u m p t i o n s . ( c ) E x c e p t i o n h a n d l i n g ad d r e s s e s r o b u s t n e s s w h e r e a s a s s e r t i o n a d d re s s e s c o rr e c tn e s s . ( d ) E x c e p t i o n h a n d l i n g d e a l s w i t h u nu s u a l c i r c u m s ta n c e s d u r i n g p r og r am e x e c u t i o n . A s s e r t i on s a r e i nt e n d e d t o e n s u r e t h e c o r re c t n e s s of t h e p r og r am .
8 . A n a l yz e t h e f ol l ow i n g c o d e . 1 . i m p o rt j ava . aw t. * ; 2 . i m p o rt j ava . aw t. e ve nt . *; 3 . i m p o rt j ava x . s w i n g . *; 4 . 5 . p u b l i c c l a s s Te s t e x t e n d s J Fr am e { 6 . p u b l i c Te s t ( ) { 7 . J B u t t on j b t OK = n e w J B u t t on ( “ OK ” ) ; 8 . J B u t t on j b t C an c e l = n e w J B u t t on ( “ C a n c e l ” ); 9 . ge tC ont e ntPa n e ( ) . ad d ( j b t O K ) ; 1 0. g e t C o nt e nt Pa n e ( ). a d d ( j b t C an c e l ) ; 1 1. j b tO K . a d d A c t i on L i s t e n e r ( t h i s ) ; 1 2. j b tC an c e l . a d d A c t i o n Li s te n e r (t h i s ) ; 1 3. } 1 4. 1 5. p u b l i c vo i d a c t i o n p e r f or m e d ( A c t i o n E ve nt e ) { 1 6. S y s t e m . o u t . p ri nt l n ( “A b u t to n i s c l i cke d ”) ; 1 7. } 1 8. 1 9. p u b l i c s t at i c vo i d m a i n ( S tr i n g [ ] a r gs ) { 2 0. J Fr am e f r am e = n e w Te s t( ) ; 2 1. f ra m e . s e tS i z e (3 0 0, 30 0) ; 2 2. f ra m e . s e tD e f a u l t C l o s e O p e r at i o n (J Fr am e . E X I T O N C L O S E ) ; 2 3. f ra m e . s e tV i s i b l e (t r u e ) ; 2 4. } 2 5. }
( a) T h e p r og ra m h a s s y nt a x e r r or s on Li n e 1 5 b e c a u s e th e s i g n at u r e o f ac t i o n p e r f o rm e d i s w r on g . ( b ) T h e p r og r am h as r u nt i m e e rr o r s o n Li n e s 9 an d 10 b e c a u s e j b t OK an d j b t C a n c e l ar e ad d e d t o t h e s a m e l o c a t i on i n t h e c ont a i n e r . ( c ) T h e p r og ra m h a s s y nt a x e r r or s on Li n e 2 0 b e c a u s e n e w Te s t ( ) i s as s i gn e d t o f r am e (a var i a b l e o f J Fr am e ) .
( d ) T h e p r og ra m h a s s y nt a x e r r or s on Li n e s 1 1 an d 12 b e c au s e Te s t d o e s n o t i m p l e m e nt A c t i o n Li s te n e r .
9 . T h e ge tK e y C o d e () m e t h o d of t h e K e yE ve nt r e t u r n s .
( a) t h e E B S D I C c o d e o f t h e ch ar a c t e r
( b ) t h e U n i c o d e c o d e o f th e ch ar a c t e r ( c ) a ch a ra c t e r ( d ) t h e A S C I I c o d e o f t h e ch ar a c t e r
1 0. c a n n ot b e s h ar e d by a G U I c om p o n e nt ?
( a) A Font o b j e c t
( b ) A C ol o r o b j e c t
( c ) A l ayo u t o b j e c t
( d ) A G U I c om p o n e nt
1 1. Yo u c an c on s tr u c t a J Ta b b e d Pa n e u s i n g .
( a) n e w J Ta b b e d Pa n e ( C o m p on e nt [ ] )
( b ) n e w J Ta b b e d Pa n e ( )
( c ) n e w J Ta b b e d Pa n e ( C o m p on e nt )
( d ) n e w J Ta b b e d Pa n e ( C o m p on e nt , C om p o n e nt )
1 2. W h i ch o f th e f o l l ow i n g m e t h o d w i l l n ot c r e at e a Li n e B o rd e r?
( a) n e w L i n e B o rd e r( C o l o r. Y E LL OW , 3 , t r u e )
( b ) n e w L i n e B o rd e r( C o l o r. Y E LL OW , 3 )
( c ) n e w L i n e B o rd e r( )
( d ) B o r d e r Fa c t or y. c r e a t e L i n e B o r d e r (C ol o r . Y E L LOW )
1 3. Yo u c an n o t s e t an i m a g e I c o n p r o p e r ty o n .
( a) a J C h e ck B ox M e nu I t e m
( b ) a J M e nu I t e m
( c ) a J R ad i o B u t t on M e nu I te m
( d ) a J m e nu B a r
1 4. a re r e f e r r e d t o a s h e av y we i ght c o m p o n e nts .
( a) G U I c o m p on e nt s
( b ) N o n - G U I c o m p on e nt s
( c ) S w i n g c o m p o n e nts
( d ) AW T c o m p on e nt s
1 5. W h i ch o f th e f o l l ow i n g c l a s s e s i s a h e av y we i g ht c o m p o ne nt ?
( a) J Pa n e l ( b ) J Fr a m e ( c ) J B u t t o n ( d ) J Te x tF i e l d
1 6. H ow m a ny f r am e s ar e d i s p l aye d ? i m p o r t j avax . s w i n g . * ; p u b l i c c l as s Te s t e x t e n d s J Fr a m 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[ ] ar g s ) { J Fr a m e f 1 = n e w Te s t ( ) ; J Fr a m e f 2 = n e w Te s t ( ) ; J Fr a m e f 3 = n e w Te s t ( ) ; f 1 . s e t V i s i b l e ( t r u e ) ; f 2 . s e t V i s i b l e ( t r u e ) ; f 3 . s e t V i s i b l e ( t r u e ) ; } }
( a) 1 . ( b ) 3 . ( c ) 2 . ( d ) 0 .
1 7. T h e m e t h o d s e t s t h e f o r e gr o u n d c o l o r t o ye l l ow i n J Fr am e f .
( a) s e t For e g r ou n d ( C o l or . Y E L L OW )
( b ) f . s e tFor e G ro u n d ( C o l or . ye l l ow )
( c ) s e t For e g r ou n d ( C o l or . ye l l ow )
( d ) f . s e tFor e g r ou n d ( C o l or . ye l l ow )
1 8. G i ve n a G r a p h i c s o b j e c t g, t o d r aw a p o l y go n t o c on n e c t p oi nt s ( 3 , 3) , ( 4 , 10 ) , (1 0 , 20 ) , (2 , 1 00 ), yo u u s e
( a) g . d raw Po l yg on ( n e w i nt [ ] 3, 4 , 1 0 , 2 , n e w i nt [ ] 3 , 1 0, 20 , 1 0 0, 4 )
( b ) g . d raw Po l yl i n e ( 3 , 4 , 1 0, 2, 3, 10 , 2 0, 10 0 , 4)
( c ) g . d raw Po l yg on ( 3 , 4 , 1 0, 2, 3, 10 , 2 0, 10 0 , 4)
( d ) g . d raw Po l yl i n e ( n e w i nt [ ] 3, 4 , 1 0 , 2 , n e w i nt [ ] 3 , 1 0, 20 , 1 0 0, 4 )
1 9. I f yo u c re at e a J S p i n n e r ob j e c t w i th o u t s p e c i f y i n g a m o d e l , t h e s p i n n e r d i s p l ays .
( a) a s e q u e n c e o f d o u b l e val u e s
( b ) a s e q u e n c e o f n o n - n e g a ti ve i nt e g e r s
( c ) a s e q u e n c e o f p o s i t i ve i nt e g e r s
( d ) a s e q u e n c e o f i nt e g e r s
2 0. To c r e at e an I n p u t S tr e a m o n a s o cke t s , yo u u s e .
( a) I n p u t S t r e am i n = s . g e t S t re am ( ) ;
( b ) I n p u t S t r e am i n = s . g e t I n p u t S t re am ( ) ;
( c ) I n p u t S t r e am i n = n e w I n p u t S t re a m ( s ) ;
( d ) I n p u t S t r e am i n = s . o b t ai n I n p u t S t r e am ( ) ;
B D A A B C A D B D B C D D B B D A D B
( b ) T h e i n i t ( ) m e t h o d i s d e fi n e d i n t h e A p p l e t c l a s s , a n d i t i s ove r ri d d e n i n c o r r e c t l y b e c au s e i t c an n o t c l ai m e x c e p t i o n s i n th e s u b c l as s . ( c ) T h e s l e e p ( ) m e t h o d i s n o t i nvo ke d c o rr e c tl y ; i t s h ou l d b e i nvoke d as T h r e a d . s l e e p ( 10 0 0) . ( d ) T h e s l e e p ( ) m e t h o d s h ou l d b e p u t i n t h e t r y- c a tch b l o ck. T h i s i s t h e o n l y r e a s on f or th e c o m p i l at i o n f a i l u r e .
2 . H ow d o you c re at e a c as h e d t h r e ad p o ol ?
( a) E x e c u t o rS e rv i c e e x e c u t o r = E x e c u t o rs . n e w C a ch e d T h r e a d Po o l ( 1) ;
( b ) E x e c u t o rS e rv i c e e x e c u t o r = E x e c u t o rs . n e w C a ch e d T h r e a d Po o l ( 2) ;
( c ) E x e c u t o rS e rv i c e e x e c u t o r = E x e c u t o rs . n e w C a ch e d T h r e a d Po o l ( 3)
; ( d ) E x e c u t o rS e rv i c e e x e c u t o r = E x e c u t o rs . n e w C a ch e d T h r e a d Po o l ( );
3 . W h i ch m e t h o d o n a c o n d i t i on s h o u l d yo u i nvoke t o c a u s e s t h e c u r r e nt t h r e a d t o wai t u nti l t h e c o n d i ti o n i s s i g n al e d ?
( a) c o n d i t i on . awa i t ( ); ( b ) c o n d i t i on . wa i te d () ; ( c ) c o n d i t i on . wa i t( ) ; ( d ) c o n d i t i on . wa i ti n g ( ) ;
4 . W h i ch o f th e f o l l ow i n g m e t h o d s c an b e u s e d t o o bt a i n a p e rm i t f ro m a S e m ap h o re s ?
( a) a c q u i re () ( b ) a s k () ( c ) d e l e t e ( ) ( d ) g e t ()
5 . 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) Yo u u s e t h e ke y wo rd t h row s to d e c l ar e e x c e p t i on s i n t h e m e t h o d h e ad i n g . ( b ) I f a ch e cke d e x c e p ti o n o c c u rs i n a m e th o d , i t n e e d n ot t o b e e i t h e r c au g ht or d e c l a re d t o b e th r ow n f r o m t h e m e t h o d . ( c ) A m e th o d may d e c l a r e t o t h r ow mu l t i p l e e x c e p t i on s .
( d ) To th r ow a n e x c e p t i o n , u s e t h e ke y wo r d t h row .
6 . W h a t i s d i s p l aye d o n t h e c on s o l e w h e n r u n n i n g t h e f ol l ow i n g p ro g ra m ? c l a s s Te s t { p u b l i c s t at i c vo i d m a i n (S t r i n g[ ] ar g s ) { t r y { S y s t e m . o u t. p r i nt l n (“ We l c om e t o J ava ” ); i nt i = 0 ; i nt y = 2 /i ; S y s t e m . o u t. p r i nt l n (“ We l c om e t o J ava ” ); } c a t ch ( Ru nt i m e E x c e p t i o n e x ) { S y s t e m . o u t. p r i nt l n (“ We l c om e t o J ava ” ); } fi n a l l y { S y s t e m . o u t. p r i nt l n (“ E n d of t he b l o ck ”) ; } S y s t e m . o u t. p r i nt l n (“ E n d of t he b l o ck ”) ; } }
( a) T h e p r og ra m d i s p l ay s We l c o m e t o J ava two t i m e s f o l l owe d by E n d o f t h e b l o ck . ( b ) T h e p r og ra m d i s p l ay s We l c o m e t o J ava t h re e t i m e s f o ll owe d by E n d o f t h e b l o ck .
( c ) T h e p r og ra m d i s p l ay s We l c o m e t o J ava two t i m e s f o l l owe d by E n d o f t h e b l o ck two t i m e s .
( d ) Yo u c an n o t c a tch Ru nt i m e E x c e p t i o n e r r o rs .
7 . W h i ch o f th e f o l l ow i n g i s f a l s e ?
( a) u s e as s e r t i on s f o r ar g u m e nt ch e ck i n g i n p u b l i c m e t ho d s .
( b ) U s e as s e r t i on s t o re affi r m a s s u m p t i o n s . ( c ) E x c e p t i o n h a n d l i n g ad d r e s s e s r o b u s t n e s s w h e r e a s a s s e r t i o n a d d re s s e s c o rr e c tn e s s . ( d ) E x c e p t i o n h a n d l i n g d e a l s w i t h u nu s u a l c i r c u m s ta n c e s d u r i n g p r og r am e x e c u t i o n . A s s e r t i on s a r e i nt e n d e d t o e n s u r e t h e c o r re c t n e s s of t h e p r og r am .
8 . A n a l yz e t h e f ol l ow i n g c o d e . 1 . i m p o rt j ava . aw t. * ; 2 . i m p o rt j ava . aw t. e ve nt . *; 3 . i m p o rt j ava x . s w i n g . *; 4 . 5 . p u b l i c c l a s s Te s t e x t e n d s J Fr am e { 6 . p u b l i c Te s t ( ) { 7 . J B u t t on j b t OK = n e w J B u t t on ( “ OK ” ) ; 8 . J B u t t on j b t C an c e l = n e w J B u t t on ( “ C a n c e l ” ); 9 . ge tC ont e ntPa n e ( ) . ad d ( j b t O K ) ; 1 0. g e t C o nt e nt Pa n e ( ). a d d ( j b t C an c e l ) ; 1 1. j b tO K . a d d A c t i on L i s t e n e r ( t h i s ) ; 1 2. j b tC an c e l . a d d A c t i o n Li s te n e r (t h i s ) ; 1 3. } 1 4. 1 5. p u b l i c vo i d a c t i o n p e r f or m e d ( A c t i o n E ve nt e ) { 1 6. S y s t e m . o u t . p ri nt l n ( “A b u t to n i s c l i cke d ”) ; 1 7. } 1 8. 1 9. p u b l i c s t at i c vo i d m a i n ( S tr i n g [ ] a r gs ) { 2 0. J Fr am e f r am e = n e w Te s t( ) ; 2 1. f ra m e . s e tS i z e (3 0 0, 30 0) ; 2 2. f ra m e . s e tD e f a u l t C l o s e O p e r at i o n (J Fr am e . E X I T O N C L O S E ) ; 2 3. f ra m e . s e tV i s i b l e (t r u e ) ; 2 4. } 2 5. }
( a) T h e p r og ra m h a s s y nt a x e r r or s on Li n e 1 5 b e c a u s e th e s i g n at u r e o f ac t i o n p e r f o rm e d i s w r on g . ( b ) T h e p r og r am h as r u nt i m e e rr o r s o n Li n e s 9 an d 10 b e c a u s e j b t OK an d j b t C a n c e l ar e ad d e d t o t h e s a m e l o c a t i on i n t h e c ont a i n e r . ( c ) T h e p r og ra m h a s s y nt a x e r r or s on Li n e 2 0 b e c a u s e n e w Te s t ( ) i s as s i gn e d t o f r am e (a var i a b l e o f J Fr am e ) .
( d ) T h e p r og ra m h a s s y nt a x e r r or s on Li n e s 1 1 an d 12 b e c au s e Te s t d o e s n o t i m p l e m e nt A c t i o n Li s te n e r .
9 . T h e ge tK e y C o d e () m e t h o d of t h e K e yE ve nt r e t u r n s .
( a) t h e E B S D I C c o d e o f t h e ch ar a c t e r
( b ) t h e U n i c o d e c o d e o f th e ch ar a c t e r ( c ) a ch a ra c t e r ( d ) t h e A S C I I c o d e o f t h e ch ar a c t e r
1 0. c a n n ot b e s h ar e d by a G U I c om p o n e nt ?
( a) A Font o b j e c t
( b ) A C ol o r o b j e c t
( c ) A l ayo u t o b j e c t
( d ) A G U I c om p o n e nt
1 1. Yo u c an c on s tr u c t a J Ta b b e d Pa n e u s i n g .
( a) n e w J Ta b b e d Pa n e ( C o m p on e nt [ ] )
( b ) n e w J Ta b b e d Pa n e ( )
( c ) n e w J Ta b b e d Pa n e ( C o m p on e nt )
( d ) n e w J Ta b b e d Pa n e ( C o m p on e nt , C om p o n e nt )
1 2. W h i ch o f th e f o l l ow i n g m e t h o d w i l l n ot c r e at e a Li n e B o rd e r?
( a) n e w L i n e B o rd e r( C o l o r. Y E LL OW , 3 , t r u e )
( b ) n e w L i n e B o rd e r( C o l o r. Y E LL OW , 3 )
( c ) n e w L i n e B o rd e r( )
( d ) B o r d e r Fa c t or y. c r e a t e L i n e B o r d e r (C ol o r . Y E L LOW )
1 3. Yo u c an n o t s e t an i m a g e I c o n p r o p e r ty o n .
( a) a J C h e ck B ox M e nu I t e m
( b ) a J M e nu I t e m
( c ) a J R ad i o B u t t on M e nu I te m
( d ) a J m e nu B a r
1 4. a re r e f e r r e d t o a s h e av y we i ght c o m p o n e nts .
( a) G U I c o m p on e nt s
( b ) N o n - G U I c o m p on e nt s
( c ) S w i n g c o m p o n e nts
( d ) AW T c o m p on e nt s
1 5. W h i ch o f th e f o l l ow i n g c l a s s e s i s a h e av y we i g ht c o m p o ne nt ?
( a) J Pa n e l ( b ) J Fr a m e ( c ) J B u t t o n ( d ) J Te x tF i e l d
1 6. H ow m a ny f r am e s ar e d i s p l aye d ? i m p o r t j avax . s w i n g . * ; p u b l i c c l as s Te s t e x t e n d s J Fr a m 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[ ] ar g s ) { J Fr a m e f 1 = n e w Te s t ( ) ; J Fr a m e f 2 = n e w Te s t ( ) ; J Fr a m e f 3 = n e w Te s t ( ) ; f 1 . s e t V i s i b l e ( t r u e ) ; f 2 . s e t V i s i b l e ( t r u e ) ; f 3 . s e t V i s i b l e ( t r u e ) ; } }
( a) 1 . ( b ) 3 . ( c ) 2 . ( d ) 0 .
1 7. T h e m e t h o d s e t s t h e f o r e gr o u n d c o l o r t o ye l l ow i n J Fr am e f .
( a) s e t For e g r ou n d ( C o l or . Y E L L OW )
( b ) f . s e tFor e G ro u n d ( C o l or . ye l l ow )
( c ) s e t For e g r ou n d ( C o l or . ye l l ow )
( d ) f . s e tFor e g r ou n d ( C o l or . ye l l ow )
1 8. G i ve n a G r a p h i c s o b j e c t g, t o d r aw a p o l y go n t o c on n e c t p oi nt s ( 3 , 3) , ( 4 , 10 ) , (1 0 , 20 ) , (2 , 1 00 ), yo u u s e
( a) g . d raw Po l yg on ( n e w i nt [ ] 3, 4 , 1 0 , 2 , n e w i nt [ ] 3 , 1 0, 20 , 1 0 0, 4 )
( b ) g . d raw Po l yl i n e ( 3 , 4 , 1 0, 2, 3, 10 , 2 0, 10 0 , 4)
( c ) g . d raw Po l yg on ( 3 , 4 , 1 0, 2, 3, 10 , 2 0, 10 0 , 4)
( d ) g . d raw Po l yl i n e ( n e w i nt [ ] 3, 4 , 1 0 , 2 , n e w i nt [ ] 3 , 1 0, 20 , 1 0 0, 4 )
1 9. I f yo u c re at e a J S p i n n e r ob j e c t w i th o u t s p e c i f y i n g a m o d e l , t h e s p i n n e r d i s p l ays .
( a) a s e q u e n c e o f d o u b l e val u e s
( b ) a s e q u e n c e o f n o n - n e g a ti ve i nt e g e r s
( c ) a s e q u e n c e o f p o s i t i ve i nt e g e r s
( d ) a s e q u e n c e o f i nt e g e r s
2 0. To c r e at e an I n p u t S tr e a m o n a s o cke t s , yo u u s e .
( a) I n p u t S t r e am i n = s . g e t S t re am ( ) ;
( b ) I n p u t S t r e am i n = s . g e t I n p u t S t re am ( ) ;
( c ) I n p u t S t r e am i n = n e w I n p u t S t re a m ( s ) ;
( d ) I n p u t S t r e am i n = s . o b t ai n I n p u t S t r e am ( ) ;
B D A A B C A D B D B C D D B B D A D B
0 comments:
Post a Comment