Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

2013-11-09 JJUG CCC Fall Lightning Talks - Java...

2013-11-09 JJUG CCC Fall Lightning Talks - Java Quick Quiz

Java Quick Quiz for Lightning Talks. Japan Java User Group (JJUG), Cross Community Conference Fall 2013.

Takayuki Okazaki

November 09, 2013
Tweet

More Decks by Takayuki Okazaki

Other Decks in Programming

Transcript

  1. J AVA Q U I C K Q U I

    Z WA T E R M I N T. O R G TA K A Y U K I O K A Z A K I P R E S E N T S
  2. A : ਖ਼ ৗ ܥ ʂ B : ί ϯύΠϧ

    Τϥ ʔ Ω ϟ ο ν ͞ Ε ͳ ͍ ྫ ֎
  3. p u b l i c c l a s

    s Q u i z 1 { p u b l i c Q u i z 1 ( ) { h t t p : / / w a t e r m i n t . o r g } }
  4. p u b l i c c l a s

    s Q u i z 1 { p u b l i c Q u i z 1 ( ) { h t t p : / / w a t e r m i n t . o r g } } ! Q u i z 1 . j a v a : 4 : Τϥ ʔ : ࣜ ͷ ։ ࢝ ͕ ෆ ਖ਼ Ͱ ͢ } ^ Q u i z 1 . j a v a : 5 : Τϥ ʔ : ߏ จ ղ ੳ த ʹ ϑ Ν Πϧ ͷ ऴ Θ Γ ʹ Ҡ Γ · ͠ ͨ } ^ Τϥ ʔ 2 ݸ
  5. p u b l i c c l a s

    s Q u i z 2 { p u b l i c s t a t i c S t r i n g l u c k e y L e t t e r ( S t r i n g s e e d ) { i n t i = M a t h . a b s ( s e e d . h a s h C o d e ( ) ) % s e e d . l e n g t h ( ) ; r e t u r n s e e d . s u b s t r i n g ( i , i + 1 ) ; } ! p u b l i c s t a t i c v o i d m a i n ( S t r i n g . . . a r g s ) { S y s t e m . o u t . p r i n t l n ( l u c k e y L e t t e r ( " a c e t o t h i e n o n e r u l e d o m " ) ) ; } }
  6. E x c e p t i o n i

    n t h r e a d " m a i n " j a v a . l a n g . S t r i n g I n d e x O u t O f B o u n d s E x c e p t i o n : S t r i n g i n d e x o u t o f r a n g e : - 8 a t j a v a . l a n g . S t r i n g . s u b s t r i n g ( S t r i n g . j a v a : 1 9 5 2 ) a t Q u i z 2 . l u c k e y L e t t e r ( Q u i z 2 . j a v a : 4 ) a t Q u i z 2 . m a i n ( Q u i z 2 . j a v a : 7 )
  7. p u b l i c c l a s

    s Q u i z 3 { p u b l i c s t a t i c v o i d m a i n ( S t r i n g . . . a r g s ) { S y s t e m . o u t . p r i n t l n ( " H e l l o " ) ; S y s t e m . o u t . c l o s e ( ) ; S y s t e m . o u t . p r i n t l n ( " W o r l d " ) ; } }
  8. p u b l i c c l a s

    s Q u i z 3 { p u b l i c s t a t i c v o i d m a i n ( S t r i n g . . . a r g s ) { S y s t e m . o u t . p r i n t l n ( " H e l l o " ) ; S y s t e m . o u t . c l o s e ( ) ; S y s t e m . o u t . p r i n t l n ( " W o r l d " ) ; } } ! $ j a v a Q u i z 3 H e l l o
  9. p u b l i c c l a s

    s Q u i z 4 { p u b l i c s t a t i c v o i d m a i n ( S t r i n g [ ] a r g s ) { f o r ( b y t e b = B y t e . M I N _ V A L U E ; b < B y t e . M A X _ V A L U E ; b + + ) { i f ( b = = 0 x 9 9 ) { t h r o w n e w 
 R u n t i m e E x c e p t i o n ( " N i n e t y n i n e " ) ; } } } }
  10. $ j a v a c Q u i z

    4 . j a v a ! $ j a v a Q u i z 4
  11. p u b l i c c l a s

    s Q u i z 5 { p u b l i c s t a t i c v o i d m a i n ( S t r i n g . . . a r g s ) { t r y { S y s t e m . o u t . p r i n t l n ( " D u k e " ) ; S y s t e m . e x i t ( 0 ) ; } f i n a l l y { t h r o w n e w R u n t i m e E x c e p t i o n ( " N e v e r d i e " ) ; } } }
  12. $ j a v a c Q u i z

    5 . j a v a ! $ j a v a Q u i z 5 D u k e
  13. p u b l i c c l a s

    s Q u i z 6 { p u b l i c Q u i z 6 ( O b j e c t o ) { S y s t e m . o u t . p r i n t l n ( " J a v a ! " ) ; } p u b l i c Q u i z 6 ( b y t e [ ] a ) { t h r o w n e w R u n t i m e E x c e p t i o n ( " O o p s ! " ) ; } p u b l i c s t a t i c v o i d m a i n ( S t r i n g . . . a r g s ) { n e w Q u i z 6 ( n u l l ) ; } }
  14. $ j a v a c Q u i z

    6 . j a v a ! $ j a v a Q u i z 6 E x c e p t i o n i n t h r e a d " m a i n " j a v a . l a n g . R u n t i m e E x c e p t i o n : O o p s ! a t Q u i z 6 . < i n i t > ( Q u i z 6 . j a v a : 6 ) a t Q u i z 6 . m a i n ( Q u i z 6 . j a v a : 9 )
  15. p u b l i c c l a s

    s Q u i z 7 { p u b l i c s t a t i c v o i d g r e e t ( ) { S y s t e m . o u t . p r i n t l n ( " J J U G ! " ) ; } p u b l i c s t a t i c v o i d m a i n ( S t r i n g . . . a r g s ) { ( ( Q u i z 7 ) n u l l ) . g r e e t ( ) ; } }
  16. $ j a v a c Q u i z

    7 . j a v a ! $ j a v a Q u i z 7 J J U G !
  17. p u b l i c c l a s

    s Q u i z 8 { s t a t i c S h o r t s ; p u b l i c s t a t i c v o i d a d d ( s h o r t a , s h o r t b ) { S y s t e m . o u t . p r i n t l n ( a + b ) ; } p u b l i c s t a t i c v o i d m a i n ( S t r i n g . . . a r g s ) { a d d ( s , ( s h o r t ) 1 0 ) ; } }
  18. $ j a v a Q u i z 8

    E x c e p t i o n i n t h r e a d " m a i n " j a v a . l a n g . N u l l P o i n t e r E x c e p t i o n a t Q u i z 8 . m a i n ( Q u i z 8 . j a v a : 7 )