{"id":4630,"date":"2019-10-21T00:55:50","date_gmt":"2019-10-20T15:55:50","guid":{"rendered":"https:\/\/chat-messenger.com\/?p=4630"},"modified":"2023-11-13T01:14:20","modified_gmt":"2023-11-12T16:14:20","slug":"%e0%b8%ad%e0%b8%b4%e0%b8%99%e0%b8%aa%e0%b9%81%e0%b8%95%e0%b8%99%e0%b8%8b%e0%b9%8c-java","status":"publish","type":"post","link":"https:\/\/chat-messenger.com\/th\/blog\/java\/java-instanceof","title":{"rendered":"Java \u5909\u6570\u306e\u578b\u3092 instanceof \u3067\u78ba\u8a8d\u3059\u308b"},"content":{"rendered":"<h2 class=\"wp-block-heading\">\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\u0e02\u0e2d\u0e07\u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e19\u0e35\u0e49\u0e41\u0e2a\u0e14\u0e07\u0e27\u0e34\u0e18\u0e35\u0e01\u0e32\u0e23\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e0a\u0e19\u0e34\u0e14\u0e02\u0e2d\u0e07\u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23\u0e43\u0e19\u0e20\u0e32\u0e29\u0e32 Java<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Java \u0e40\u0e1b\u0e47\u0e19\u0e20\u0e32\u0e29\u0e32\u0e17\u0e35\u0e48\u0e21\u0e35\u0e01\u0e32\u0e23\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e41\u0e1a\u0e1a\u0e04\u0e07\u0e17\u0e35\u0e48 \u0e42\u0e14\u0e22\u0e21\u0e35\u0e01\u0e32\u0e23\u0e1b\u0e23\u0e30\u0e01\u0e32\u0e28\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e0a\u0e31\u0e14\u0e40\u0e08\u0e19 \u0e14\u0e31\u0e07\u0e19\u0e31\u0e49\u0e19\u0e08\u0e36\u0e07\u0e44\u0e21\u0e48\u0e04\u0e48\u0e2d\u0e22\u0e21\u0e35\u0e42\u0e2d\u0e01\u0e32\u0e2a\u0e21\u0e32\u0e01\u0e19\u0e31\u0e01\u0e17\u0e35\u0e48\u0e08\u0e30\u0e15\u0e49\u0e2d\u0e07\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25 \u0e2d\u0e22\u0e48\u0e32\u0e07\u0e44\u0e23\u0e01\u0e47\u0e15\u0e32\u0e21 \u0e40\u0e21\u0e37\u0e48\u0e2d\u0e43\u0e0a\u0e49\u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23\u0e17\u0e35\u0e48\u0e2a\u0e37\u0e1a\u0e17\u0e2d\u0e14\u0e21\u0e32 \u0e01\u0e32\u0e23\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e2d\u0e32\u0e08\u0e21\u0e35\u0e04\u0e27\u0e32\u0e21\u0e08\u0e33\u0e40\u0e1b\u0e47\u0e19<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e27\u0e34\u0e18\u0e35\u0e01\u0e32\u0e23\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e0a\u0e19\u0e34\u0e14\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e19\u0e20\u0e32\u0e29\u0e32 Java <strong>instanceof<\/strong> \u0e04\u0e38\u0e13\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49\u0e15\u0e31\u0e27\u0e14\u0e33\u0e40\u0e19\u0e34\u0e19\u0e01\u0e32\u0e23\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e1b\u0e23\u0e30\u0e40\u0e21\u0e34\u0e19\u0e04\u0e25\u0e32\u0e2a\u0e41\u0e25\u0e30\u0e2d\u0e34\u0e19\u0e40\u0e17\u0e2d\u0e23\u0e4c\u0e40\u0e1f\u0e0b\u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07 if \u0e44\u0e14\u0e49\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49:<\/p>\n\n\n\n<div class=\"wp-block-group is-style-big_icon_good\"><div class=\"wp-block-group__inner-container\">\n<p class=\"wp-block-paragraph\"><em>\u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23<\/em> instanceof \u30af\u30e9\u30b9<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>\u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23<\/em> instanceof \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9<\/p>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>instanceof<\/strong> \u0e04\u0e38\u0e13\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e23\u0e30\u0e1a\u0e38\u0e0a\u0e37\u0e48\u0e2d\u0e04\u0e25\u0e32\u0e2a\u0e2b\u0e23\u0e37\u0e2d\u0e0a\u0e37\u0e48\u0e2d\u0e2d\u0e34\u0e19\u0e40\u0e17\u0e2d\u0e23\u0e4c\u0e40\u0e1f\u0e0b\u0e44\u0e14\u0e49\u0e17\u0e32\u0e07\u0e14\u0e49\u0e32\u0e19\u0e02\u0e27\u0e32\u0e21\u0e37\u0e2d<strong>instanceof<\/strong> \u0e04\u0e48\u0e32\u0e17\u0e35\u0e48\u0e2a\u0e48\u0e07\u0e01\u0e25\u0e31\u0e1a\u0e40\u0e1b\u0e47\u0e19\u0e04\u0e48\u0e32\u0e1a\u0e39\u0e25\u0e35\u0e19 \u0e41\u0e25\u0e30\u0e16\u0e49\u0e32\u0e40\u0e1b\u0e47\u0e19\u0e08\u0e23\u0e34\u0e07 \u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23\u0e19\u0e31\u0e49\u0e19\u0e08\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e04\u0e25\u0e32\u0e2a\u0e2b\u0e23\u0e37\u0e2d\u0e2d\u0e34\u0e19\u0e40\u0e17\u0e2d\u0e23\u0e4c\u0e40\u0e1f\u0e0b\u0e17\u0e35\u0e48\u0e23\u0e30\u0e1a\u0e38\u0e44\u0e27\u0e49<\/p>\n\n\n\n<div class=\"recommend\">\n<p><a href=\"javascript:clickAdd()\">\u0e41\u0e0a\u0e17\u0e41\u0e25\u0e30\u0e2a\u0e48\u0e07\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21<\/a> \u0e19\u0e35\u0e48\u0e04\u0e37\u0e2d\u0e0b\u0e2d\u0e1f\u0e15\u0e4c\u0e41\u0e27\u0e23\u0e4c\u0e01\u0e25\u0e38\u0e48\u0e21\u0e07\u0e32\u0e19\u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e07\u0e48\u0e32\u0e22\u0e41\u0e25\u0e30\u0e04\u0e23\u0e1a\u0e27\u0e07\u0e08\u0e23 \u0e0b\u0e36\u0e48\u0e07\u0e23\u0e27\u0e21\u0e1f\u0e31\u0e07\u0e01\u0e4c\u0e0a\u0e31\u0e19\u0e15\u0e48\u0e32\u0e07\u0e46 \u0e44\u0e27\u0e49\u0e14\u0e49\u0e27\u0e22\u0e01\u0e31\u0e19 \u0e40\u0e0a\u0e48\u0e19 \u0e01\u0e32\u0e23\u0e41\u0e0a\u0e17\u0e17\u0e32\u0e07\u0e18\u0e38\u0e23\u0e01\u0e34\u0e08 \u0e01\u0e32\u0e23\u0e1b\u0e23\u0e30\u0e0a\u0e38\u0e21\u0e1c\u0e48\u0e32\u0e19\u0e40\u0e27\u0e47\u0e1a \u0e01\u0e32\u0e23\u0e41\u0e0a\u0e23\u0e4c\u0e44\u0e1f\u0e25\u0e4c \u0e01\u0e32\u0e23\u0e08\u0e31\u0e14\u0e01\u0e32\u0e23\u0e15\u0e32\u0e23\u0e32\u0e07\u0e40\u0e27\u0e25\u0e32 \u0e01\u0e32\u0e23\u0e08\u0e31\u0e14\u0e01\u0e32\u0e23\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23 \u0e01\u0e32\u0e23\u0e08\u0e2d\u0e07\u0e2b\u0e49\u0e2d\u0e07\u0e1b\u0e23\u0e30\u0e0a\u0e38\u0e21 \u0e41\u0e25\u0e30\u0e01\u0e32\u0e23\u0e08\u0e31\u0e14\u0e01\u0e32\u0e23\u0e01\u0e32\u0e23\u0e40\u0e02\u0e49\u0e32\u0e07\u0e32\u0e19 \u0e19\u0e2d\u0e01\u0e08\u0e32\u0e01\u0e19\u0e35\u0e49\u0e22\u0e31\u0e07\u0e21\u0e2d\u0e1a\u0e23\u0e30\u0e1a\u0e1a\u0e23\u0e31\u0e01\u0e29\u0e32\u0e04\u0e27\u0e32\u0e21\u0e1b\u0e25\u0e2d\u0e14\u0e20\u0e31\u0e22\u0e17\u0e35\u0e48\u0e41\u0e02\u0e47\u0e07\u0e41\u0e01\u0e23\u0e48\u0e07\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e18\u0e38\u0e23\u0e01\u0e34\u0e08\u0e2d\u0e35\u0e01\u0e14\u0e49\u0e27\u0e22<mark>\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e44\u0e14\u0e49\u0e1f\u0e23\u0e35!<\/mark><\/p>\n<a href=\"javascript:clickAdd()\"><img decoding=\"async\" style=\"margin:10px;box-shadow: var(--swl-box_shadow);\" src=\"\/images\/cam-top-banner.png\" width=\"700\"><\/a>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e21\u0e32\u0e40\u0e23\u0e34\u0e48\u0e21\u0e08\u0e32\u0e01\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e17\u0e35\u0e48\u0e07\u0e48\u0e32\u0e22\u0e17\u0e35\u0e48\u0e2a\u0e38\u0e14\u0e01\u0e48\u0e2d\u0e19 \u0e16\u0e49\u0e32\u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23 i \u0e40\u0e1b\u0e47\u0e19\u0e08\u0e33\u0e19\u0e27\u0e19\u0e40\u0e15\u0e47\u0e21 \u0e08\u0e30\u0e2a\u0e48\u0e07\u0e04\u0e37\u0e19\u0e04\u0e48\u0e32 true \u0e21\u0e34\u0e40\u0e0a\u0e48\u0e19\u0e19\u0e31\u0e49\u0e19\u0e08\u0e30\u0e2a\u0e48\u0e07\u0e04\u0e37\u0e19\u0e04\u0e48\u0e32 false<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e42\u0e04\u0e49\u0e14<\/h4>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-java\" data-lang=\"Java\"><code>public static void integerSample() {\n    Integer i = 100;\n    boolean result = i instanceof Integer;\n    System.out.println(result);\n}<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e17\u0e35\u0e48\u0e44\u0e14\u0e49<\/h4>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>true<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u5909\u6570 i \u306f Integer \u306a\u306e\u3067\u3001\u7d50\u679c\u306f true \u306b\u306a\u308a\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u3053\u308c\u3067\u306f\u5f53\u305f\u308a\u524d\u3059\u304e\u3066 instanceof \u304c\u306a\u3093\u306e\u305f\u3081\u306b\u3042\u308b\u304b\u5206\u304b\u306a\u3044\u306e\u3067\u3001\u3082\u3046\u5c11\u3057\u8907\u96d1\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">instanceof \u306e\u52b9\u679c\u7684\u306a\u4f7f\u3044\u65b9<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">instanceof \u306e\u52b9\u679c\u7684\u306a\u4f7f\u3044\u65b9\u306e\u4e00\u3064\u306b\u3001\u305d\u306e\u5909\u6570\u304c\u3069\u306e\u5b50\u30af\u30e9\u30b9\u306a\u306e\u304b\u3092\u5224\u5b9a\u3059\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e42\u0e04\u0e49\u0e14<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e42\u0e04\u0e49\u0e14\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e19\u0e35\u0e49\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e04\u0e25\u0e32\u0e2a\u0e2a\u0e31\u0e15\u0e27\u0e4c\u0e0a\u0e37\u0e48\u0e2d Animal \u0e41\u0e25\u0e30\u0e2d\u0e35\u0e01\u0e2a\u0e2d\u0e07\u0e04\u0e25\u0e32\u0e2a\u0e04\u0e37\u0e2d Dog \u0e41\u0e25\u0e30 Cat \u0e0b\u0e36\u0e48\u0e07\u0e2a\u0e37\u0e1a\u0e17\u0e2d\u0e14\u0e21\u0e32\u0e08\u0e32\u0e01\u0e04\u0e25\u0e32\u0e2a Animal \u0e2b\u0e25\u0e31\u0e07\u0e08\u0e32\u0e01\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e2d\u0e34\u0e19\u0e2a\u0e41\u0e15\u0e19\u0e0b\u0e4c\u0e41\u0e25\u0e49\u0e27 \u0e08\u0e30\u0e43\u0e0a\u0e49\u0e40\u0e21\u0e18\u0e2d\u0e14 `play` \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e04\u0e48\u0e32\u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23 <strong>instanceof<\/strong> \u0e23\u0e30\u0e1a\u0e1a\u0e08\u0e30\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e2a\u0e34\u0e48\u0e07\u0e19\u0e35\u0e49\u0e41\u0e25\u0e30\u0e41\u0e22\u0e01\u0e40\u0e2d\u0e32\u0e15\u0e4c\u0e1e\u0e38\u0e15\u0e44\u0e1b\u0e22\u0e31\u0e07\u0e04\u0e2d\u0e19\u0e42\u0e0b\u0e25\u0e15\u0e32\u0e21\u0e19\u0e31\u0e49\u0e19 <\/p>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-java\" data-lang=\"Java\"><code>class Animal {} \nclass Dog extends Animal {}\nclass Cat extends Animal {}\n\npublic class Main {\n    public static void main(String[] args) {\n        instanceofSample();\n    }\n    \n    static void instanceofSample() {\n        Animal dog = new Dog();\n        play(dog);\n        Animal cat = new Cat();\n        play(cat);\n    }\n    \n    static void play(Animal animal) {\n        if (animal instanceof Dog) {\n            System.out.println(&quot;\u304a\u6563\u6b69\u3059\u308b&quot;);\n        } else {\n            System.out.println(&quot;\u732b\u3058\u3083\u3089\u3057\u3067\u904a\u3076&quot;);\n        }\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e17\u0e35\u0e48\u0e44\u0e14\u0e49<\/h4>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>\u304a\u6563\u6b69\u3059\u308b\n\u732b\u3058\u3083\u3089\u3057\u3067\u904a\u3076<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e1b\u0e23\u0e30\u0e40\u0e14\u0e47\u0e19\u0e2a\u0e33\u0e04\u0e31\u0e0d\u0e04\u0e37\u0e2d \u0e20\u0e32\u0e22\u0e43\u0e19\u0e40\u0e21\u0e18\u0e2d\u0e14 `play` \u0e19\u0e31\u0e49\u0e19 \u0e40\u0e1b\u0e47\u0e19\u0e44\u0e1b\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e17\u0e35\u0e48\u0e08\u0e30\u0e23\u0e39\u0e49\u0e27\u0e48\u0e32 `animal` \u0e17\u0e35\u0e48\u0e2a\u0e48\u0e07\u0e21\u0e32\u0e40\u0e1b\u0e47\u0e19\u0e2d\u0e32\u0e23\u0e4c\u0e01\u0e34\u0e27\u0e40\u0e21\u0e19\u0e15\u0e4c\u0e19\u0e31\u0e49\u0e19\u0e40\u0e1b\u0e47\u0e19\u0e2a\u0e38\u0e19\u0e31\u0e02\u0e2b\u0e23\u0e37\u0e2d\u0e41\u0e21\u0e27<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>instanceof<\/strong> \u0e14\u0e31\u0e07\u0e19\u0e31\u0e49\u0e19 \u0e40\u0e19\u0e37\u0e48\u0e2d\u0e07\u0e08\u0e32\u0e01\u0e40\u0e23\u0e32\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e2d\u0e34\u0e19\u0e2a\u0e41\u0e15\u0e19\u0e0b\u0e4c\u0e02\u0e2d\u0e07\u0e04\u0e25\u0e32\u0e2a\u0e22\u0e48\u0e2d\u0e22 (\u0e40\u0e0a\u0e48\u0e19 \u0e2a\u0e38\u0e19\u0e31\u0e02 \u0e2b\u0e23\u0e37\u0e2d \u0e41\u0e21\u0e27) \u0e17\u0e35\u0e48\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19\u0e04\u0e25\u0e32\u0e2a\u0e2b\u0e25\u0e31\u0e01 (\u0e40\u0e0a\u0e48\u0e19 \u0e2a\u0e31\u0e15\u0e27\u0e4c) \u0e44\u0e14\u0e49 \u0e40\u0e23\u0e32\u0e08\u0e36\u0e07\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e43\u0e19\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e19\u0e35\u0e49\u0e44\u0e14\u0e49\u0e40\u0e0a\u0e48\u0e19\u0e01\u0e31\u0e19<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e27\u0e48\u0e32\u0e21\u0e35\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e2d\u0e34\u0e19\u0e40\u0e17\u0e2d\u0e23\u0e4c\u0e40\u0e1f\u0e0b\u0e17\u0e35\u0e48\u0e23\u0e30\u0e1a\u0e38\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">instanceof \u306e\u5bfe\u8c61\u3068\u306a\u308b\u5909\u6570\u306b\u3001\u3042\u308b\u7279\u5b9a\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3053\u306e\u3088\u3046\u306a\u4f7f\u3044\u65b9\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e42\u0e04\u0e49\u0e14<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u6b21\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067\u306f\u3001\u4f50\u85e4\u3055\u3093\u3001\u9234\u6728\u3055\u3093\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u3001\u9234\u6728\u3055\u3093\u3060\u3051\u304c\u8eca\u3092\u6301\u3063\u3066\u3044\u308b\u60f3\u5b9a\u3067\u3001\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9 Car \u3092 implements \u3057\u3066\u3044\u307e\u3059\u3002goShopping() \u30e1\u30bd\u30c3\u30c9\u306f\u8cb7\u3044\u7269\u306b\u884c\u304f\u51e6\u7406\u3092\u4eee\u5b9a\u3057\u3066\u3044\u307e\u3059\u304c\u3001Car \u3092 implements \u3057\u3066\u3044\u308b\u304b\u3001instanceof \u3067\u5224\u5b9a\u3057\u3066\u30b3\u30f3\u30bd\u30fc\u30eb\u51fa\u529b\u3092\u5206\u5c90\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-java\" data-lang=\"Java\"><code>interface Car {}\nclass Sato {}\nclass Suzuki implements Car {}\n\npublic class Main {\n    public static void main(String[] args) throws Exception {\n        instanceofSample();\n    }\n    \n    static void instanceofSample() {\n        Sato sato = new Sato();\n        goShopping(sato);\n\n        Suzuki suzuki = new Suzuki();\n        goShopping(suzuki);\n    }\n    \n    static void goShopping(Object human) {\n        if (human instanceof Car) {\n            System.out.println(&quot;\u8eca\u3067\u884c\u304f&quot;);\n        } else {\n            System.out.println(&quot;\u6b69\u3044\u3066\u884c\u304f&quot;);\n        }\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e17\u0e35\u0e48\u0e44\u0e14\u0e49:<\/h4>\n\n\n\n<div class=\"hcb_wrap\" data-no-translation=\"\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>\u6b69\u3044\u3066\u884c\u304f\n\u8eca\u3067\u884c\u304f<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e04\u0e38\u0e13\u0e08\u0e30\u0e40\u0e2b\u0e47\u0e19\u0e27\u0e48\u0e32\u0e01\u0e23\u0e30\u0e1a\u0e27\u0e19\u0e01\u0e32\u0e23\u0e17\u0e33\u0e07\u0e32\u0e19\u0e08\u0e30\u0e41\u0e15\u0e01\u0e15\u0e48\u0e32\u0e07\u0e01\u0e31\u0e19\u0e44\u0e1b \u0e02\u0e36\u0e49\u0e19\u0e2d\u0e22\u0e39\u0e48\u0e01\u0e31\u0e1a\u0e27\u0e48\u0e32\u0e21\u0e35\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e1f\u0e31\u0e07\u0e01\u0e4c\u0e0a\u0e31\u0e19 Car \u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48<\/p>","protected":false},"excerpt":{"rendered":"<p>\u5909\u6570\u306e\u578b\u3092\u78ba\u8a8d\u3059\u308b Java \u3067\u5909\u6570\u306e\u578b\u3092\u78ba\u8a8d\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 Java \u306f\u578b\u3092\u660e\u793a\u7684\u306b\u5ba3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9054,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[19],"tags":[],"class_list":["post-4630","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/4630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/comments?post=4630"}],"version-history":[{"count":6,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/4630\/revisions"}],"predecessor-version":[{"id":9049,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/posts\/4630\/revisions\/9049"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/media\/9054"}],"wp:attachment":[{"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/media?parent=4630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/categories?post=4630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chat-messenger.com\/th\/wp-json\/wp\/v2\/tags?post=4630"}],"curies":[{"name":"\u0e14\u0e31\u0e1a\u0e40\u0e1a\u0e34\u0e25\u0e22\u0e39\u0e1e\u0e35","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}