{"id":93919,"date":"2025-12-31T15:10:19","date_gmt":"2025-12-31T08:10:19","guid":{"rendered":"https:\/\/itviec.com\/blog\/?p=93919"},"modified":"2026-01-12T17:42:33","modified_gmt":"2026-01-12T10:42:33","slug":"implement-trong-java","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/implement-trong-java\/","title":{"rendered":"Implement trong Java l\u00e0 g\u00ec? Ph\u00e2n bi\u1ec7t implements v\u00e0 extends"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/implement-trong-java\/#Khai_niem_Interface_va_tu_khoa_implements\" >Kh\u00e1i ni\u1ec7m Interface v\u00e0 t\u1eeb kh\u00f3a implements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/implement-trong-java\/#Su_khac_biet_giua_implements_Interface_va_extends_Abstract_Class\" >S\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa implements (Interface) v\u00e0 extends (Abstract Class)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/implement-trong-java\/#Khi_nao_su_dung_Interface_va_khi_nao_su_dung_Abstract_Class\" >Khi n\u00e0o s\u1eed d\u1ee5ng Interface v\u00e0 khi n\u00e0o s\u1eed d\u1ee5ng Abstract Class?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/implement-trong-java\/#Cac_cau_hoi_thuong_gap_ve_Implement_trong_Java\" >C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Implement trong Java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/implement-trong-java\/#Tong_ket\" >T\u1ed5ng k\u1ebft<\/a><\/li><\/ul><\/nav><\/div>\n\n<p><strong><em>Trong l\u1eadp tr\u00ecnh Java, Class v\u00e0 Interface l\u00e0 c\u00e1c th\u00e0nh ph\u1ea7n c\u1ed1t l\u00f5i \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u1ea5u tr\u00fac \u1ee9ng d\u1ee5ng. \u0110\u1ec3 k\u1ebft n\u1ed1i c\u00e1c th\u00e0nh ph\u1ea7n n\u00e0y m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3, l\u1eadp tr\u00ecnh vi\u00ean c\u1ea7n n\u1eafm v\u1eefng c\u01a1 ch\u1ebf c\u1ee7a t\u1eeb kh\u00f3a <code>implements<\/code>. Vi\u1ec7c s\u1eed d\u1ee5ng <code>implements<\/code> \u0111\u00fang c\u01a1 ch\u1ebf s\u1ebd gi\u00fap gi\u1ea3m s\u1ef1 ph\u1ee5 thu\u1ed9c gi\u1eefa c\u00e1c module v\u00e0 t\u0103ng kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng cho m\u00e3 ngu\u1ed3n.<\/em><\/strong><\/p>\n\n\n\n<p>N\u1ed9i dung d\u01b0\u1edbi \u0111\u00e2y s\u1ebd ph\u00e2n t\u00edch chi ti\u1ebft c\u00e1ch th\u1ee9c <code>implements<\/code> ho\u1ea1t \u0111\u1ed9ng \u0111\u1ed1i v\u1edbi Interface v\u00e0 Abstract Class, \u0111\u1ed3ng th\u1eddi minh h\u1ecda qua c\u00e1c v\u00ed d\u1ee5 c\u1ee5 th\u1ec3 trong d\u1ef1 \u00e1n th\u1ef1c t\u1ebf. \u0110\u1ecdc b\u00e0i vi\u1ebft n\u00e0y \u0111\u1ec3 hi\u1ec3u th\u00eam v\u1ec1:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Kh\u00e1i ni\u1ec7m Interface v\u00e0 T\u1eeb kh\u00f3a implements<\/li>\n\n\n\n<li>Kh\u00e1i ni\u1ec7m Abstract Class v\u00e0 K\u1ebf Th\u1eeba (extends)<\/li>\n\n\n\n<li>Khi n\u00e0o s\u1eed d\u1ee5ng Interface v\u00e0 khi n\u00e0o s\u1eed d\u1ee5ng Abstract Class?<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em>\u0110\u1ecdc chi ti\u1ebft: <strong><a href=\"https:\/\/itviec.com\/blog\/java-la-gi\/\" target=\"_blank\" rel=\"noreferrer noopener\">Java l\u00e0 g\u00ec? T\u1ea5t c\u1ea3 nh\u1eefng \u0111i\u1ec1u b\u1ea1n c\u1ea7n bi\u1ebft v\u1ec1 ng\u00f4n ng\u1eef Java<\/a><\/strong><\/em><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-khai-ni\u1ec7m-interface-va-t\u1eeb-khoa-implements\"><span class=\"ez-toc-section\" id=\"Khai_niem_Interface_va_tu_khoa_implements\"><\/span><strong>Kh\u00e1i ni\u1ec7m Interface v\u00e0 t\u1eeb kh\u00f3a implements<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-qua-trinh-implement-trong-java-la-gi\"><strong>Qu\u00e1 tr\u00ecnh &#8220;implement&#8221; trong Java l\u00e0 g\u00ec?<\/strong><\/h3>\n\n\n\n<p>Trong l\u1eadp tr\u00ecnh h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng v\u1edbi Java, &#8220;implement&#8221; (tri\u1ec3n khai) l\u00e0 qu\u00e1 tr\u00ecnh m\u1ed9t Class cung c\u1ea5p logic th\u1ef1c thi c\u1ee5 th\u1ec3 cho c\u00e1c h\u00e0nh vi tr\u1eebu t\u01b0\u1ee3ng \u0111\u00e3 \u0111\u01b0\u1ee3c khai b\u00e1o tr\u01b0\u1edbc \u0111\u00f3. N\u00f3i c\u00e1ch kh\u00e1c, \u0111\u00e2y l\u00e0 h\u00e0nh \u0111\u1ed9ng hi\u1ec7n th\u1ef1c h\u00f3a c\u00e1c \u0111\u1eb7c t\u1ea3 k\u1ef9 thu\u1eadt th\u00e0nh m\u00e3 ngu\u1ed3n ho\u1ea1t \u0111\u1ed9ng \u0111\u01b0\u1ee3c.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-interface-giao-di\u1ec7n\"><strong>Interface (Giao di\u1ec7n)<\/strong><\/h3>\n\n\n\n<p>Interface l\u00e0 m\u1ed9t c\u1ea5u tr\u00fac tham chi\u1ebfu, \u0111\u00f3ng vai tr\u00f2 l\u00e0 b\u1ea3n thi\u1ebft k\u1ebf (blueprint) quy \u0111\u1ecbnh c\u00e1c ph\u01b0\u01a1ng th\u1ee9c m\u00e0 m\u1ed9t l\u1edbp c\u1ea7n c\u00f3.<\/p>\n\n\n\n<p><strong>V\u1ec1 c\u1ea5u tr\u00fac:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Interface ch\u1ec9 ch\u1ee9a c\u00e1c ch\u1eef k\u00fd ph\u01b0\u01a1ng th\u1ee9c (method signatures) v\u00e0 h\u1eb1ng s\u1ed1.&nbsp;<\/li>\n\n\n\n<li>T\u1eeb Java 8, Interface \u0111\u01b0\u1ee3c m\u1edf r\u1ed9ng th\u00eam kh\u1ea3 n\u0103ng ch\u1ee9a <code>default method<\/code> v\u00e0 <code>static method<\/code> c\u00f3 ph\u1ea7n th\u00e2n.<\/li>\n<\/ul>\n\n\n\n<p><strong>\u0110\u1eb7c t\u00ednh k\u1ef9 thu\u1eadt:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>M\u1eb7c \u0111\u1ecbnh, t\u1ea5t c\u1ea3 c\u00e1c ph\u01b0\u01a1ng th\u1ee9c trong Interface \u0111\u1ec1u l\u00e0 <code>public abstract<\/code> (tr\u1eeb default\/static\/private methods).<\/li>\n\n\n\n<li>C\u00e1c bi\u1ebfn \u0111\u01b0\u1ee3c khai b\u00e1o trong Interface m\u1eb7c \u0111\u1ecbnh l\u00e0 <code>public static final<\/code> (h\u1eb1ng s\u1ed1).<\/li>\n<\/ul>\n\n\n\n<p>M\u1ee5c \u0111\u00edch l\u00e0 \u0111\u1ec3 thi\u1ebft l\u1eadp m\u1ed9t chu\u1ea9n giao ti\u1ebfp chung gi\u1eefa c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng kh\u00f4ng c\u00f9ng quan h\u1ec7 k\u1ebf th\u1eeba, \u0111\u1ea3m b\u1ea3o t\u00ednh nh\u1ea5t qu\u00e1n v\u1ec1 h\u00e0nh vi trong h\u1ec7 th\u1ed1ng.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-t\u1eeb-khoa-implements\"><strong>T\u1eeb kh\u00f3a implements<\/strong><\/h3>\n\n\n\n<p>\u0110\u00e2y l\u00e0 t\u1eeb kh\u00f3a \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 x\u00e1c l\u1eadp m\u1ed1i quan h\u1ec7 gi\u1eefa m\u1ed9t Class v\u00e0 m\u1ed9t (ho\u1eb7c nhi\u1ec1u) Interface.<\/p>\n\n\n\n<p><strong>Vai tr\u00f2:<\/strong> Khi m\u1ed9t Class khai b\u00e1o <code>implements<\/code> m\u1ed9t Interface, Class \u0111\u00f3 bu\u1ed9c ph\u1ea3i <code>override<\/code> (ghi \u0111\u00e8) v\u00e0 vi\u1ebft m\u00e3 x\u1eed l\u00fd cho to\u00e0n b\u1ed9 c\u00e1c ph\u01b0\u01a1ng th\u1ee9c tr\u1eebu t\u01b0\u1ee3ng c\u1ee7a Interface \u0111\u00f3. N\u1ebfu kh\u00f4ng th\u1ef1c hi\u1ec7n \u0111\u1ee7, Class \u0111\u00f3 ph\u1ea3i \u0111\u01b0\u1ee3c khai b\u00e1o l\u00e0 <code>abstract<\/code>.<\/p>\n\n\n\n<p><strong>Kh\u1ea3 n\u0103ng \u0111a h\u00ecnh:<\/strong> Java kh\u00f4ng h\u1ed7 tr\u1ee3 \u0111a k\u1ebf th\u1eeba v\u1edbi Class (extends), nh\u01b0ng cho ph\u00e9p m\u1ed9t Class tri\u1ec3n khai nhi\u1ec1u Interface c\u00f9ng l\u00fac.<\/p>\n\n\n\n<p><strong>C\u00fa ph\u00e1p:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class TenClass implements TenInterface1, TenInterface2 {\n    \/\/ Logic tri\u1ec3n khai c\u00e1c ph\u01b0\u01a1ng th\u1ee9c\n}<\/code><\/pre>\n\n\n\n<p><strong>V\u00ed d\u1ee5 minh h\u1ecda<\/strong><\/p>\n\n\n\n<p>D\u01b0\u1edbi \u0111\u00e2y l\u00e0 v\u00ed d\u1ee5 v\u1ec1 Interface <code>AnimalBehavior<\/code> quy \u0111\u1ecbnh h\u00e0nh vi di chuy\u1ec3n, v\u00e0 Class <code>Dog<\/code> tri\u1ec3n khai h\u00e0nh vi \u0111\u00f3.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ 1. \u0110\u1ecbnh ngh\u0129a Interface\npublic interface AnimalBehavior {\n    \/\/ Ph\u01b0\u01a1ng th\u1ee9c tr\u1eebu t\u01b0\u1ee3ng (m\u1eb7c \u0111\u1ecbnh l\u00e0 public abstract)\n    void move();\n}\n\n\/\/ 2. Class tri\u1ec3n khai Interface\npublic class Dog implements AnimalBehavior {\n    \n    \/\/ B\u1eaft bu\u1ed9c ph\u1ea3i Override ph\u01b0\u01a1ng th\u1ee9c t\u1eeb Interface\n    @Override\n    public void move() {\n        System.out.println(\"Ch\u00f3 di chuy\u1ec3n b\u1eb1ng b\u1ed1n ch\u00e2n.\");\n    }\n}\n\n\/\/ 3. S\u1eed d\u1ee5ng\npublic class Main {\n    public static void main(String&#91;] args) {\n        \/\/ \u00c1p d\u1ee5ng t\u00ednh \u0111a h\u00ecnh: Tham chi\u1ebfu Interface tr\u1ecf t\u1edbi \u0111\u1ed1i t\u01b0\u1ee3ng Class\n        AnimalBehavior myDog = new Dog();\n        myDog.move(); \n    }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-s\u1ef1-khac-bi\u1ec7t-gi\u1eefa-implements-interface-va-extends-abstract-class\"><span class=\"ez-toc-section\" id=\"Su_khac_biet_giua_implements_Interface_va_extends_Abstract_Class\"><\/span><strong>S\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa implements (Interface) v\u00e0 extends (Abstract Class)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-abstract-class-l\u1edbp-tr\u1eebu-t\u01b0\u1ee3ng\"><strong>Abstract Class (L\u1edbp tr\u1eebu t\u01b0\u1ee3ng)<\/strong><\/h3>\n\n\n\n<p>Abstract Class l\u00e0 m\u1ed9t lo\u1ea1i l\u1edbp \u0111\u1eb7c bi\u1ec7t trong Java, \u0111\u01b0\u1ee3c khai b\u00e1o v\u1edbi t\u1eeb kh\u00f3a <code>abstract<\/code>.<\/p>\n\n\n\n<p><strong>\u0110\u1ecbnh ngh\u0129a k\u1ef9 thu\u1eadt:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Kh\u00f4ng th\u1ec3 kh\u1edfi t\u1ea1o tr\u1ef1c ti\u1ebfp (kh\u00f4ng th\u1ec3 s\u1eed d\u1ee5ng t\u1eeb kh\u00f3a <code>new<\/code> \u0111\u1ec3 t\u1ea1o instance).<\/li>\n\n\n\n<li>C\u00f3 c\u1ea5u tr\u00fac linh ho\u1ea1t: C\u00f3 th\u1ec3 ch\u1ee9a c\u00e1c ph\u01b0\u01a1ng th\u1ee9c tr\u1eebu t\u01b0\u1ee3ng (abstract methods &#8211; ch\u01b0a c\u00f3 ph\u1ea7n th\u00e2n) \u0111\u1ec3 l\u1edbp con b\u1eaft bu\u1ed9c ph\u1ea3i ghi \u0111\u00e8, v\u00e0 c\u00e1c ph\u01b0\u01a1ng th\u1ee9c c\u1ee5 th\u1ec3 (concrete methods &#8211; \u0111\u00e3 c\u00f3 logic x\u1eed l\u00fd) \u0111\u1ec3 l\u1edbp con t\u00e1i s\u1eed d\u1ee5ng.<\/li>\n<\/ul>\n\n\n\n<p><strong>M\u1ee5c \u0111\u00edch s\u1eed d\u1ee5ng:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0110\u00f3ng vai tr\u00f2 l\u00e0 l\u1edbp c\u01a1 s\u1edf (Base class) trong c\u1ea5u tr\u00fac ph\u00e2n c\u1ea5p.<\/li>\n\n\n\n<li>T\u1ed1i \u01b0u h\u00f3a m\u00e3 ngu\u1ed3n b\u1eb1ng c\u00e1ch t\u1eadp trung c\u00e1c logic chung v\u00e0o ph\u01b0\u01a1ng th\u1ee9c c\u1ee5 th\u1ec3, \u0111\u1ed3ng th\u1eddi \u0111\u1ecbnh h\u01b0\u1edbng c\u1ea5u tr\u00fac cho c\u00e1c l\u1edbp con th\u00f4ng qua c\u00e1c ph\u01b0\u01a1ng th\u1ee9c tr\u1eebu t\u01b0\u1ee3ng.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-phan-bi\u1ec7t-implements-interface-va-extends-abstract-class\"><strong>Ph\u00e2n bi\u1ec7t implements (Interface) v\u00e0 extends (Abstract Class)<\/strong><\/h3>\n\n\n\n<p>Vi\u1ec7c ph\u00e2n bi\u1ec7t r\u00f5 hai t\u1eeb kh\u00f3a n\u00e0y gi\u00fap l\u1eadp tr\u00ecnh vi\u00ean l\u1ef1a ch\u1ecdn gi\u1ea3i ph\u00e1p thi\u1ebft k\u1ebf ph\u00f9 h\u1ee3p cho ki\u1ebfn tr\u00fac ph\u1ea7n m\u1ec1m.<\/p>\n\n\n\n<p><strong>V\u1ec1 b\u1ea3n ch\u1ea5t:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>implements<\/strong><strong> (v\u1edbi Interface):<\/strong> T\u1eadp trung v\u00e0o <strong>h\u00e0nh vi (Behavior)<\/strong>. N\u00f3 quy \u0111\u1ecbnh m\u1ed9t l\u1edbp <em>c\u00f3 kh\u1ea3 n\u0103ng l\u00e0m g\u00ec<\/em>, b\u1ea5t k\u1ec3 l\u1edbp \u0111\u00f3 thu\u1ed9c ph\u00e2n c\u1ea5p n\u00e0o.<\/li>\n\n\n\n<li><strong>extends<\/strong><strong> (v\u1edbi Abstract Class):<\/strong> T\u1eadp trung v\u00e0o <strong>quan h\u1ec7 k\u1ebf th\u1eeba (Inheritance)<\/strong>. N\u00f3 x\u00e1c \u0111\u1ecbnh m\u1ed9t l\u1edbp <em>l\u00e0 c\u00e1i g\u00ec<\/em> (quan h\u1ec7 &#8220;Is-A&#8221;), k\u1ebf th\u1eeba c\u1ea3 tr\u1ea1ng th\u00e1i (bi\u1ebfn) v\u00e0 h\u00e0nh vi c\u1ee7a l\u1edbp cha.<\/li>\n<\/ul>\n\n\n\n<p><strong>V\u1ec1 gi\u1edbi h\u1ea1n k\u1ef9 thu\u1eadt (L\u01b0u \u00fd quan tr\u1ecdng):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u0110\u01a1n k\u1ebf th\u1eeba (Single Inheritance):<\/strong> Java ch\u1ec9 cho ph\u00e9p m\u1ed9t l\u1edbp <code>extends<\/code> duy nh\u1ea5t m\u1ed9t l\u1edbp cha (Abstract Class ho\u1eb7c Class th\u01b0\u1eddng). \u0110i\u1ec1u n\u00e0y nh\u1eb1m tr\u00e1nh s\u1ef1 ph\u1ee9c t\u1ea1p c\u1ee7a v\u1ea5n \u0111\u1ec1 &#8220;Diamond Problem&#8221; trong \u0111a k\u1ebf th\u1eeba.<\/li>\n\n\n\n<li><strong>\u0110a th\u1ef1c thi (Multiple Implementation):<\/strong> M\u1ed9t l\u1edbp c\u00f3 th\u1ec3 <code>implements<\/code> nhi\u1ec1u Interface c\u00f9ng l\u00fac. \u0110\u00e2y l\u00e0 gi\u1ea3i ph\u00e1p c\u1ee7a Java \u0111\u1ec3 t\u1ed5ng h\u1ee3p nhi\u1ec1u h\u00e0nh vi kh\u00e1c nhau v\u00e0o m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng m\u00e0 kh\u00f4ng ph\u00e1 v\u1ee1 c\u1ea5u tr\u00fac c\u00e2y k\u1ebf th\u1eeba.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-khi-nao-s\u1eed-d\u1ee5ng-interface-va-khi-nao-s\u1eed-d\u1ee5ng-abstract-class\"><span class=\"ez-toc-section\" id=\"Khi_nao_su_dung_Interface_va_khi_nao_su_dung_Abstract_Class\"><\/span><strong>Khi n\u00e0o s\u1eed d\u1ee5ng Interface v\u00e0 khi n\u00e0o s\u1eed d\u1ee5ng Abstract Class?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Vi\u1ec7c l\u1ef1a ch\u1ecdn gi\u1eefa Interface v\u00e0 Abstract Class kh\u00f4ng ch\u1ec9 d\u1ef1a tr\u00ean c\u00fa ph\u00e1p m\u00e0 ph\u1ee5 thu\u1ed9c v\u00e0o c\u1ea5u tr\u00fac d\u1eef li\u1ec7u v\u00e0 m\u1ed1i quan h\u1ec7 gi\u1eefa c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng trong h\u1ec7 th\u1ed1ng.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-dung-interface-khi-d-\u1ecbnh-nghia-kh\u1ea3-nang-capabilities-cho-cac-l\u1edbp-khong-lien-quan\"><strong>D\u00f9ng Interface khi \u0111<\/strong><strong>\u1ecbnh ngh\u0129a kh\u1ea3 n\u0103ng (capabilities) cho c\u00e1c l\u1edbp kh\u00f4ng li\u00ean quan<\/strong><\/h3>\n\n\n\n<p>S\u1eed d\u1ee5ng Interface khi b\u1ea1n mu\u1ed1n m\u00f4 t\u1ea3 \u0111\u1ed1i t\u01b0\u1ee3ng &#8220;c\u00f3 th\u1ec3 l\u00e0m g\u00ec&#8221; (Can-do behavior) thay v\u00ec \u0111\u1ed1i t\u01b0\u1ee3ng &#8220;l\u00e0 c\u00e1i g\u00ec&#8221;. C\u00e1c l\u1edbp th\u1ef1c thi Interface n\u00e0y c\u00f3 th\u1ec3 n\u1eb1m \u1edf c\u00e1c nh\u00e1nh k\u1ebf th\u1eeba ho\u00e0n to\u00e0n kh\u00e1c nhau nh\u01b0ng chia s\u1ebb chung m\u1ed9t h\u00e0nh \u0111\u1ed9ng.<\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5:<\/strong> T\u00ednh n\u0103ng <code>Flyable<\/code> (C\u00f3 th\u1ec3 bay).<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>Bird<\/code> (Chim) l\u00e0 \u0111\u1ed9ng v\u1eadt.<\/li>\n\n\n\n<li><code>Airplane<\/code> (M\u00e1y bay) l\u00e0 m\u00e1y m\u00f3c c\u01a1 kh\u00ed.<\/li>\n\n\n\n<li>Hai l\u1edbp n\u00e0y kh\u00f4ng c\u00f3 quan h\u1ec7 huy\u1ebft th\u1ed1ng, nh\u01b0ng \u0111\u1ec1u c\u00f3 th\u1ec3 bay.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>interface Flyable {\n    void fly();\n}\n\nclass Bird extends Animal implements Flyable {\n    public void fly() { System.out.println(\"V\u1ed7 c\u00e1nh bay\"); }\n}\n\nclass Airplane extends Machine implements Flyable {\n    public void fly() { System.out.println(\"D\u00f9ng \u0111\u1ed9ng c\u01a1 ph\u1ea3n l\u1ef1c\"); }\n}<\/code><\/pre>\n\n\n\n<p><strong>H\u1ed7 tr\u1ee3 \u0111a k\u1ebf th\u1eeba h\u00e0nh vi:<\/strong> Do Java kh\u00f4ng h\u1ed7 tr\u1ee3 \u0111a k\u1ebf th\u1eeba class (<code>extends<\/code>), Interface l\u00e0 gi\u1ea3i ph\u00e1p duy nh\u1ea5t \u0111\u1ec3 m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng s\u1edf h\u1eefu h\u00e0nh vi t\u1eeb nhi\u1ec1u ngu\u1ed3n kh\u00e1c nhau.<\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5:<\/strong> M\u1ed9t <code>Smartphone<\/code> v\u1eeba l\u00e0 thi\u1ebft b\u1ecb \u0111i\u1ec7n t\u1eed (<code>ElectronicDevice<\/code>), v\u1eeba c\u00f3 kh\u1ea3 n\u0103ng ch\u1ee5p \u1ea3nh (<code>Camera<\/code>), v\u1eeba c\u00f3 kh\u1ea3 n\u0103ng ph\u00e1t nh\u1ea1c (<code>MusicPlayer<\/code>).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-dung-abstract-class-khi\"><strong>D\u00f9ng Abstract Class khi:<\/strong><\/h3>\n\n\n\n<p><strong>1. Quan h\u1ec7 &#8220;L\u00e0 m\u1ed9t&#8221; (Is-A Relationship) ch\u1eb7t ch\u1ebd:<\/strong> S\u1eed d\u1ee5ng Abstract Class khi c\u00e1c l\u1edbp con th\u1ef1c s\u1ef1 l\u00e0 m\u1ed9t phi\u00ean b\u1ea3n c\u1ee5 th\u1ec3 c\u1ee7a l\u1edbp cha v\u00e0 chia s\u1ebb chung b\u1ea3n ch\u1ea5t \u0111\u1ed1i t\u01b0\u1ee3ng.<\/p>\n\n\n\n<p><strong>2. C\u1ea7n chia s\u1ebb tr\u1ea1ng th\u00e1i v\u00e0 logic chung (Code Reuse):<\/strong> Khi c\u00e1c l\u1edbp con c\u00f3 nh\u1eefng \u0111o\u1ea1n m\u00e3 gi\u1ed1ng h\u1ec7t nhau, Abstract Class cho ph\u00e9p vi\u1ebft logic \u0111\u00f3 m\u1ed9t l\u1ea7n \u1edf l\u1edbp cha (concrete method) v\u00e0 ch\u1ec9 \u0111\u1ec3 l\u1ea1i nh\u1eefng ph\u1ea7n kh\u00e1c bi\u1ec7t cho l\u1edbp con t\u1ef1 x\u1eed l\u00fd (abstract method).<\/p>\n\n\n\n<p><strong>V\u00ed d\u1ee5:<\/strong> H\u1ec7 th\u1ed1ng qu\u1ea3n l\u00fd ph\u01b0\u01a1ng ti\u1ec7n <code>Vehicle<\/code>.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>M\u1ecdi ph\u01b0\u01a1ng ti\u1ec7n \u0111\u1ec1u c\u00f3 th\u00f4ng tin <code>brand<\/code> (Nh\u00e3n hi\u1ec7u) v\u00e0 h\u00e0nh vi <code>startEngine()<\/code> (Kh\u1edfi \u0111\u1ed9ng) gi\u1ed1ng nhau.<\/li>\n\n\n\n<li>Tuy nhi\u00ean, h\u00e0nh vi <code>drive()<\/code> (L\u00e1i) c\u1ee7a \u00d4 t\u00f4 kh\u00e1c v\u1edbi Xe m\u00e1y.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>abstract class Vehicle {\n    protected String brand;\n\n    \/\/ Logic chung: M\u1ecdi xe \u0111\u1ec1u kh\u1edfi \u0111\u1ed9ng gi\u1ed1ng nhau\n    public void startEngine() {\n        System.out.println(\"\u0110\u1ed9ng c\u01a1 \u0111\u00e3 b\u1eadt.\");\n    }\n\n    \/\/ Logic ri\u00eang: M\u1ed7i lo\u1ea1i xe l\u00e1i theo c\u00e1ch kh\u00e1c nhau\n    public abstract void drive();\n}\n\nclass Car extends Vehicle {\n    @Override\n    public void drive() {\n        System.out.println(\"L\u00e1i b\u1eb1ng v\u00f4 l\u0103ng\");\n    }\n}\n\nclass Motorbike extends Vehicle {\n    @Override\n    public void drive() {\n        System.out.println(\"L\u00e1i b\u1eb1ng tay l\u00e1i (ghi-\u0111\u00f4ng)\");\n    }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-cau-h\u1ecfi-th\u01b0\u1eddng-g\u1eb7p-v\u1ec1-implement-trong-java\"><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_thuong_gap_ve_Implement_trong_Java\"><\/span><strong>C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Implement trong Java<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-m\u1ed9t-class-co-th\u1ec3-v\u1eeba-extends-v\u1eeba-implements-khong\"><strong>M\u1ed9t Class c\u00f3 th\u1ec3 v\u1eeba <\/strong><strong>extends<\/strong><strong> v\u1eeba <\/strong><strong>implements<\/strong><strong> kh\u00f4ng?<\/strong><\/h3>\n\n\n\n<p><strong>C\u00f3.<\/strong> Java cho ph\u00e9p m\u1ed9t l\u1edbp v\u1eeba k\u1ebf th\u1eeba t\u1eeb m\u1ed9t l\u1edbp cha (Abstract ho\u1eb7c Concrete) v\u1eeba tri\u1ec3n khai m\u1ed9t ho\u1eb7c nhi\u1ec1u Interface.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Quy t\u1eafc c\u00fa ph\u00e1p:<\/strong> T\u1eeb kh\u00f3a <code>extends<\/code> ph\u1ea3i lu\u00f4n \u0111\u1ee9ng tr\u01b0\u1edbc <code>implements<\/code>.<\/li>\n\n\n\n<li><strong>V\u00ed d\u1ee5:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u0110\u00daNG\nclass Smartphone extends ElectronicDevice implements Camera, GPS { \u2026 }\n\n\/\/ SAI (L\u1ed7i bi\u00ean d\u1ecbch)\nclass Smartphone implements Camera extends ElectronicDevice { \u2026 }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-di\u1ec1u-gi-x\u1ea3y-ra-khi-implements-hai-interface-co-ph\u01b0\u01a1ng-th\u1ee9c-trung-ten\"><strong>\u0110i\u1ec1u g\u00ec x\u1ea3y ra khi <\/strong><strong>implements<\/strong><strong> hai Interface c\u00f3 ph\u01b0\u01a1ng th\u1ee9c tr\u00f9ng t\u00ean?<\/strong><\/h3>\n\n\n\n<p>C\u00f3 hai tr\u01b0\u1eddng h\u1ee3p x\u1ea3y ra:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Tr\u00f9ng ho\u00e0n to\u00e0n (T\u00ean + Tham s\u1ed1 + Ki\u1ec3u tr\u1ea3 v\u1ec1):<\/strong> Class ch\u1ec9 c\u1ea7n <code>@Override<\/code> ph\u01b0\u01a1ng th\u1ee9c \u0111\u00f3 m\u1ed9t l\u1ea7n duy nh\u1ea5t. Ph\u01b0\u01a1ng th\u1ee9c n\u00e0y s\u1ebd th\u1ecfa m\u00e3n &#8220;h\u1ee3p \u0111\u1ed3ng&#8221; c\u1ee7a c\u1ea3 hai Interface.<\/li>\n\n\n\n<li><strong>Tr\u00f9ng t\u00ean v\u00e0 tham s\u1ed1 nh\u01b0ng KH\u00c1C ki\u1ec3u tr\u1ea3 v\u1ec1:<\/strong> L\u1ed7i bi\u00ean d\u1ecbch (Compile Error). Java kh\u00f4ng cho ph\u00e9p n\u1ea1p ch\u1ed3ng (overload) d\u1ef1a tr\u00ean ki\u1ec3u tr\u1ea3 v\u1ec1, do \u0111\u00f3 Class kh\u00f4ng th\u1ec3 th\u1ecfa m\u00e3n c\u00f9ng l\u00fac hai ch\u1eef k\u00fd ph\u01b0\u01a1ng th\u1ee9c m\u00e2u thu\u1eabn nhau.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-co-th\u1ec3-kh\u1edfi-t\u1ea1o-d\u1ed1i-t\u01b0\u1ee3ng-tr\u1ef1c-ti\u1ebfp-t\u1eeb-interface-khong\"><strong>C\u00f3 th\u1ec3 kh\u1edfi t\u1ea1o \u0111\u1ed1i t\u01b0\u1ee3ng tr\u1ef1c ti\u1ebfp t\u1eeb Interface kh\u00f4ng?<\/strong><\/h3>\n\n\n\n<p><strong>Kh\u00f4ng.<\/strong> B\u1ea1n kh\u00f4ng th\u1ec3 d\u00f9ng t\u1eeb kh\u00f3a <code>new<\/code> tr\u1ef1c ti\u1ebfp v\u1edbi Interface (v\u00ed d\u1ee5: <code>new Animal()<\/code>) v\u00ec Interface kh\u00f4ng c\u00f3 h\u00e0m t\u1ea1o (constructor). Tuy nhi\u00ean, c\u00f3 th\u1ec3 t\u1ea1o \u0111\u1ed1i t\u01b0\u1ee3ng t\u1eeb Interface th\u00f4ng qua <strong>L\u1edbp \u1ea9n danh (Anonymous Class)<\/strong> \u0111\u1ec3 tri\u1ec3n khai nhanh c\u00e1c ph\u01b0\u01a1ng th\u1ee9c t\u1ea1i ch\u1ed7:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Runnable task = new Runnable() {\n    @Override\n    public void run() {\n        System.out.println(\"Running...\");\n    }\n};\n\/\/ Ho\u1eb7c d\u00f9ng Lambda Expression (Java 8+)\nRunnable taskLambda = () -&gt; System.out.println(\"Running...\");<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-n\u1ebfu-them-m\u1ed9t-ph\u01b0\u01a1ng-th\u1ee9c-m\u1edbi-vao-interface-cac-class-da-implements-co-b\u1ecb-l\u1ed7i-khong\"><strong>N\u1ebfu th\u00eam m\u1ed9t ph\u01b0\u01a1ng th\u1ee9c m\u1edbi v\u00e0o Interface, c\u00e1c Class \u0111\u00e3 implements c\u00f3 b\u1ecb l\u1ed7i kh\u00f4ng?<\/strong><\/h3>\n\n\n\n<p>C\u00f3. N\u1ebfu th\u00eam m\u1ed9t ph\u01b0\u01a1ng th\u1ee9c tr\u1eebu t\u01b0\u1ee3ng m\u1edbi v\u00e0o Interface, t\u1ea5t c\u1ea3 c\u00e1c Class \u0111ang implements Interface \u0111\u00f3 s\u1ebd b\u00e1o l\u1ed7i bi\u00ean d\u1ecbch v\u00ec ch\u01b0a override ph\u01b0\u01a1ng th\u1ee9c m\u1edbi.<\/p>\n\n\n\n<p>Gi\u1ea3i ph\u00e1p: S\u1eed d\u1ee5ng <code>default method<\/code> (t\u1eeb Java 8). T\u00ednh n\u0103ng n\u00e0y cho ph\u00e9p th\u00eam ph\u01b0\u01a1ng th\u1ee9c m\u1edbi v\u00e0o Interface k\u00e8m theo ph\u1ea7n th\u00e2n m\u1eb7c \u0111\u1ecbnh, gi\u00fap m\u1edf r\u1ed9ng Interface m\u00e0 kh\u00f4ng l\u00e0m h\u1ecfng c\u00e1c Class c\u0169.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-t\u1ed5ng-k\u1ebft\"><span class=\"ez-toc-section\" id=\"Tong_ket\"><\/span><strong>T\u1ed5ng k\u1ebft<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>T\u1eeb kh\u00f3a <code>implements<\/code> l\u00e0 c\u01a1 ch\u1ebf c\u1ed1t l\u00f5i \u0111\u1ec3 hi\u1ec7n th\u1ef1c h\u00f3a t\u00ednh tr\u1eebu t\u01b0\u1ee3ng v\u00e0 \u0111a h\u00ecnh trong Java, chuy\u1ec3n \u0111\u1ed5i c\u00e1c quy \u0111\u1ecbnh h\u00e0nh vi c\u1ee7a Interface th\u00e0nh logic th\u1ef1c thi c\u1ee5 th\u1ec3. Kh\u00e1c v\u1edbi <code>extends<\/code> t\u1eadp trung v\u00e0o quan h\u1ec7 k\u1ebf th\u1eeba v\u00e0 t\u00e1i s\u1eed d\u1ee5ng tr\u1ea1ng th\u00e1i, <code>implements<\/code> cho ph\u00e9p chu\u1ea9n h\u00f3a n\u0103ng l\u1ef1c x\u1eed l\u00fd cho c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng kh\u00f4ng c\u00f9ng ph\u00e2n c\u1ea5p, gi\u00fap gi\u1ea3m thi\u1ec3u s\u1ef1 ph\u1ee5 thu\u1ed9c gi\u1eefa c\u00e1c module (loose coupling).<\/p>\n\n\n\n<p>Vi\u1ec7c \u00e1p d\u1ee5ng ch\u00ednh x\u00e1c c\u01a1 ch\u1ebf n\u00e0y l\u00e0 ch\u00eca kh\u00f3a \u0111\u1ec3 x\u00e2y d\u1ef1ng ki\u1ebfn tr\u00fac ph\u1ea7n m\u1ec1m linh ho\u1ea1t, \u0111\u1ea3m b\u1ea3o kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u00e0 d\u1ec5 d\u00e0ng b\u1ea3o tr\u00ec thay v\u00ec ch\u1ec9 \u0111\u01a1n thu\u1ea7n \u0111\u00e1p \u1ee9ng y\u00eau c\u1ea7u c\u00fa ph\u00e1p c\u1ee7a tr\u00ecnh bi\u00ean d\u1ecbch.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em>\u0110\u1ecdc chi ti\u1ebft: <strong><a href=\"https:\/\/itviec.com\/blog\/java-core-la-gi\/\" target=\"_blank\" rel=\"noreferrer noopener\">Java Core: 5 tr\u1ee5 c\u1ed9t c\u1ed1t l\u00f5i c\u1ee7a Java m\u00e0 b\u1ea1n c\u1ea7n n\u1eafm v\u1eefng<\/a><\/strong><\/em><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Trong l\u1eadp tr\u00ecnh Java, Class v\u00e0 Interface l\u00e0 c\u00e1c th\u00e0nh ph\u1ea7n c\u1ed1t l\u00f5i \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u1ea5u tr\u00fac \u1ee9ng d\u1ee5ng. \u0110\u1ec3 k\u1ebft n\u1ed1i c\u00e1c th\u00e0nh ph\u1ea7n n\u00e0y m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3, l\u1eadp tr\u00ecnh vi\u00ean c\u1ea7n n\u1eafm v\u1eefng c\u01a1 ch\u1ebf c\u1ee7a t\u1eeb kh\u00f3a implements. Vi\u1ec7c s\u1eed d\u1ee5ng implements \u0111\u00fang c\u01a1 ch\u1ebf s\u1ebd gi\u00fap gi\u1ea3m s\u1ef1 ph\u1ee5 [&hellip;]<\/p>\n","protected":false},"author":233,"featured_media":94031,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109,10350],"tags":[],"class_list":["post-93919","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it","category-java"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Implement trong Java l\u00e0 g\u00ec? Ph\u00e2n bi\u1ec7t implements v\u00e0 extends - ITviec Blog<\/title>\n<meta name=\"description\" content=\"T\u00ecm hi\u1ec3u chi ti\u1ebft c\u00e1ch \u00e1p d\u1ee5ng t\u1eeb kh\u00f3a implement trong Java nh\u1eb1m gi\u00fap gi\u1ea3m ph\u1ee5 thu\u1ed9c gi\u1eefa c\u00e1c module v\u00e0 t\u0103ng kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng cho m\u00e3 ngu\u1ed3n.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/implement-trong-java\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Implement trong Java l\u00e0 g\u00ec? Ph\u00e2n bi\u1ec7t implements v\u00e0 extends\" \/>\n<meta property=\"og:description\" content=\"Trong l\u1eadp tr\u00ecnh Java, Class v\u00e0 Interface l\u00e0 c\u00e1c th\u00e0nh ph\u1ea7n c\u1ed1t l\u00f5i \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u1ea5u tr\u00fac \u1ee9ng d\u1ee5ng. \u0110\u1ec3 k\u1ebft n\u1ed1i c\u00e1c th\u00e0nh ph\u1ea7n n\u00e0y m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3, l\u1eadp\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/implement-trong-java\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2025-12-31T08:10:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-12T10:42:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/12\/implement-trong-java-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"421\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nhat Anh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nhat Anh\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Implement trong Java l\u00e0 g\u00ec? Ph\u00e2n bi\u1ec7t implements v\u00e0 extends - ITviec Blog","description":"T\u00ecm hi\u1ec3u chi ti\u1ebft c\u00e1ch \u00e1p d\u1ee5ng t\u1eeb kh\u00f3a implement trong Java nh\u1eb1m gi\u00fap gi\u1ea3m ph\u1ee5 thu\u1ed9c gi\u1eefa c\u00e1c module v\u00e0 t\u0103ng kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng cho m\u00e3 ngu\u1ed3n.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/implement-trong-java\/","og_locale":"vi_VN","og_type":"article","og_title":"Implement trong Java l\u00e0 g\u00ec? Ph\u00e2n bi\u1ec7t implements v\u00e0 extends","og_description":"Trong l\u1eadp tr\u00ecnh Java, Class v\u00e0 Interface l\u00e0 c\u00e1c th\u00e0nh ph\u1ea7n c\u1ed1t l\u00f5i \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u1ea5u tr\u00fac \u1ee9ng d\u1ee5ng. \u0110\u1ec3 k\u1ebft n\u1ed1i c\u00e1c th\u00e0nh ph\u1ea7n n\u00e0y m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3, l\u1eadp","og_url":"https:\/\/itviec.com\/blog\/implement-trong-java\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2025-12-31T08:10:19+00:00","article_modified_time":"2026-01-12T10:42:33+00:00","og_image":[{"width":800,"height":421,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/12\/implement-trong-java-scaled.png","type":"image\/png"}],"author":"Nhat Anh","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"Nhat Anh","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"9 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/"},"author":{"name":"Nhat Anh","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/149bc2a01a01f229e57b9cdf61f3ebd0"},"headline":"Implement trong Java l\u00e0 g\u00ec? Ph\u00e2n bi\u1ec7t implements v\u00e0 extends","datePublished":"2025-12-31T08:10:19+00:00","dateModified":"2026-01-12T10:42:33+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/"},"wordCount":2282,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/12\/implement-trong-java-scaled.png","articleSection":["Chuy\u00ean m\u00f4n IT","Java"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/","url":"https:\/\/itviec.com\/blog\/implement-trong-java\/","name":"Implement trong Java l\u00e0 g\u00ec? Ph\u00e2n bi\u1ec7t implements v\u00e0 extends - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/12\/implement-trong-java-scaled.png","datePublished":"2025-12-31T08:10:19+00:00","dateModified":"2026-01-12T10:42:33+00:00","description":"T\u00ecm hi\u1ec3u chi ti\u1ebft c\u00e1ch \u00e1p d\u1ee5ng t\u1eeb kh\u00f3a implement trong Java nh\u1eb1m gi\u00fap gi\u1ea3m ph\u1ee5 thu\u1ed9c gi\u1eefa c\u00e1c module v\u00e0 t\u0103ng kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng cho m\u00e3 ngu\u1ed3n.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/implement-trong-java\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/12\/implement-trong-java-scaled.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/12\/implement-trong-java-scaled.png","width":800,"height":421,"caption":"implement trong java - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/implement-trong-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"Implement trong Java l\u00e0 g\u00ec? Ph\u00e2n bi\u1ec7t implements v\u00e0 extends"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/149bc2a01a01f229e57b9cdf61f3ebd0","name":"Nhat Anh","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/pham-nhat-anh-vippro-196x200.jpeg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/pham-nhat-anh-vippro-196x200.jpeg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/04\/pham-nhat-anh-vippro-196x200.jpeg","caption":"Nhat Anh"},"url":"https:\/\/itviec.com\/blog\/author\/nhat-anh\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/93919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/233"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=93919"}],"version-history":[{"count":4,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/93919\/revisions"}],"predecessor-version":[{"id":94360,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/93919\/revisions\/94360"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/94031"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=93919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=93919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=93919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}