Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Trap Questions in Java and Obj-C

417.72KI
December 03, 2019

Trap Questions in Java and Obj-C

417.72KI

December 03, 2019
Tweet

More Decks by 417.72KI

Other Decks in Programming

Transcript

  1. w 5BLVIJSP.VUBBLB௣໊Նر ,*  w 4&೥ 8FC J04 "OESPJE ৽ਓݚमߨࢣFUD

    
 J04 डୗ։ൃ ೥൒
 J04 ࣗࣾ։ൃ ࠓίί w 5XJUUFS 2JJUB@LJ
 (JU)VC,* w 4XJGUѪ޷ձࢀՃप೥
 ΋͏΍ΜΧϨʔ͸೥໨ ͓લ୭Α
  2. ࣍ͷίʔυͷಈ͖͸Ͳ͏ͳΔʁ public class Sample { public static void main(String... args)

    { while (false) { System.out.println("hoge"); } } } lIPHFz͕ճ͚ͩग़ྗ͞ΕΔ Կ΋ى͖ͳ͍ ίϯύΠϧΤϥʔ ࣮ߦ࣌Τϥʔ
  3. ࣍ͷίʔυͷಈ͖͸Ͳ͏ͳΔʁ public class Sample { public static void main(String... args)

    { while (false) { System.out.println("hoge"); } } } lIPHFz͕ճ͚ͩग़ྗ͞ΕΔ Կ΋ى͖ͳ͍ ίϯύΠϧΤϥʔ ࣮ߦ࣌Τϥʔ
  4. ղઆ public class Sample { public static void main(String... args)

    { while (false) { System.out.println("hoge"); } } } 6OSFBDIBCMFDPEF
  5. ୈ໰Λ౿·͑ͯ public class Sample { public static void main(String... args)

    { while (false) { System.out.println("hoge"); } } }
  6. ࣍ͷίʔυͷಈ͖͸Ͳ͏ͳΔʁ public class Sample { public static void main(String... args)

    { do { System.out.println("hoge"); } while (false); } } lIPHFz͕ճ͚ͩग़ྗ͞ΕΔ Կ΋ى͖ͳ͍ ίϯύΠϧΤϥʔ ࣮ߦ࣌Τϥʔ
  7. ࣍ͷίʔυͷಈ͖͸Ͳ͏ͳΔʁ public class Sample { public static void main(String... args)

    { do { System.out.println("hoge"); } while (false); } } lIPHFz͕ճ͚ͩग़ྗ͞ΕΔ Կ΋ى͖ͳ͍ ίϯύΠϧΤϥʔ ࣮ߦ࣌Τϥʔ
  8. public class Sample { public static void main(String... args) {

    do { System.out.println("hoge"); } while (false); } } ղઆ EPXIJMF͸ࣄޙධՁ ճॲཧͨ͠ޙʹ৚݅ࣜΛ൑ఆ
  9. Կ͕ग़ྗ͞ΕΔʁ [ "hoge", "fuga", null, "foo", "bar" ] TBNQMFKTPO NSArray

    *array = ... // JSONΛಡΈࠐΉॲཧ if (array[2]) { NSLog(@"true"); } else { NSLog(@"false"); }
  10. Կ͕ग़ྗ͞ΕΔʁ USVF GBMTF [ "hoge", "fuga", null, "foo", "bar" ]

    TBNQMFKTPO NSArray *array = ... // JSONΛಡΈࠐΉॲཧ if (array[2]) { NSLog(@"true"); } else { NSLog(@"false"); }
  11. Կ͕ग़ྗ͞ΕΔʁ USVF GBMTF [ "hoge", "fuga", null, "foo", "bar" ]

    TBNQMFKTPO NSArray *array = ... // JSONΛಡΈࠐΉॲཧ if (array[2]) { NSLog(@"true"); } else { NSLog(@"false"); }
  12. /4/VMMͱOJM NSLog(@"%@", nil); // -> (null) NSLog(@"%@", [NSNull null]); //

    -> <null> ഑ྻʹฆΕ͍ͯΔOVMM͸Α͘ݟམͱ͕ͪ͠