[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-347826-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-347826-en":131},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","advanced-java-part-1-how-to-create-and-destroy-objects","Advanced java - Part 1 - How to create and destroy objects","","Advanced java covers core object-oriented concepts and practical language features used to build robust Java programs. It explains object lifecycle topics such as constructors, instance construction, initialization blocks, visibility, garbage collection, finalizers, and static initialization. It also reviews common object methods including equals, hashCode, toString, and clone, then extends into class and interface design, generics, and the disciplined use of enums and annotations. The material includes links to source code and clear “What’s next” transitions between sections.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/advanced-java-part-1-how-to-create-and-destroy-objects/347826/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/advanced-java-part-1-how-to-create-and-destroy-objects/347826.png","ImageObject",300,407,{"name":42,"@type":43},"Liam","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-25","2026-09-22",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",14,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What topics are covered in the section “How to create and destroy objects”?","Question",{"text":63,"@type":64},"It covers instance construction, implicit and explicit constructors, initialization blocks, construction guarantees, visibility, garbage collection, finalizers, static initialization, and common construction patterns like Singleton, Utility/Helper, Factory, and Dependency Injection.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"Which common methods for all objects does the document address?",{"text":68,"@type":64},"It discusses equals and hashCode, toString, clone, and the relationship between equals and the == operator, along with useful helper classes.",{"name":70,"@type":61,"acceptedAnswer":71},"How does the document guide the use of generics, enums, and annotations?",{"text":72,"@type":64},"It explains when and how to use generics, including interfaces/classes/methods, limitations, wildcards and bounded types, type inference, and annotations related to generics. It separately details enums and annotations, including special enum behavior, convenient enum methods, specialized collections (EnumSet/EnumMap), and annotation retention, element types, inheritance, repeatability, processors, and guidance on when to use them.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},347826,1790098950,{"code":4,"msg":82,"data":83},"success",[84,88,92,96,101,105,110,115,120,123,127],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":93,"show_sort_weight":94,"slug":95},"Exam",70,"exam",{"id":97,"doc_module":4,"doc_module_name":25,"category_name":98,"show_sort_weight":99,"slug":100},5,"Comic",60,"comic",{"id":102,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":103,"slug":104},6,50,"technology",{"id":106,"doc_module":4,"doc_module_name":25,"category_name":107,"show_sort_weight":108,"slug":109},7,"Healthcare",40,"healthcare",{"id":111,"doc_module":4,"doc_module_name":25,"category_name":112,"show_sort_weight":113,"slug":114},8,"Research & Report",30,"research-report",{"id":116,"doc_module":4,"doc_module_name":25,"category_name":117,"show_sort_weight":118,"slug":119},9,"Religion & Spirituality",20,"religion-spirituality",{"id":118,"doc_module":4,"doc_module_name":25,"category_name":121,"show_sort_weight":118,"slug":122},"World Cup","world-cup",{"id":124,"doc_module":4,"doc_module_name":25,"category_name":125,"show_sort_weight":124,"slug":126},10,"Lifestyle","lifestyle",{"id":128,"doc_module":4,"doc_module_name":25,"category_name":129,"show_sort_weight":97,"slug":130},19,"General","general",{"code":4,"msg":82,"data":132},{"doc_id":79,"user_id":133,"nickname":42,"user_avatar":134,"doc_module":4,"category_id":102,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":135,"file_id":136,"file_url":137,"file_type":138,"file_size":139,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":140,"language":141,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":142,"faqs":143,"seo_title":144,"seo_description":12,"update_tm":145,"read_time":146,"preview_page_count":147,"preview_urls":148},8796095461564,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","Advanced java  \nContents  \n1 How to create and destroy objects 1  \n1.1 Introduction ...................................................... 1  \n1.2 Instance Construction ................................................. 1  \n1.2.1 Implicit (Generated) Constructor ....................................... 1  \n1.2.2 Constructors without Arguments ....................................... 1  \n1.2.3 Constructors with Arguments ........................................ 2  \n1.2.4 Initialization Blocks ............................................. 2  \n1.2.5 Construction guarantee ............................................ 3  \n1.2.6 Visibility ................................................... 4  \n1.2.7 Garbage collection .............................................. 4  \n1.2.8 Finalizers ................................................... 5  \n1.3 Static initialization .................................................. 5  \n1.4 Construction Patterns ................................................. 5  \n1.4.1 Singleton ................................................... 6  \n1.4.2 Utility/Helper Class ............................................. 7  \n1.4.3 Factory .................................................... 7  \n1.4.4 Dependency Injection ............................................ 8  \n1.5 Download the Source Code .............................................. 9  \n1.6 What's next ...................................................... 9  \n2 Using methods common to all objects 10  \n2.1 Introduction ...................................................... 10  \n2.2 Methods equals and hashCode ............................................ 11  \n2.3 Method toString .................................................... 13  \n2.4 Method clone ..................................................... 14  \n2.5 Method equals and == operator ............................................ 15  \n2.6 Useful helper classes ................................................. 15  \n2.7 Download the Source Code .............................................. 16  \n2.8 What's next ...................................................... 16  \n3 How to design Classes and Interfaces 17  \n3.1 Introduction ...................................................... 17  \n3.2 Interfaces ....................................................... 17  \n3.3 Marker Interfaces ................................................... 18  \n3.4 Functional interfaces, default and static methods ................................... 19  \n3.5 Abstract classes .................................................... 20  \n3.6 Immutable classes ................................................... 20  \n3.7 Anonymous classes .................................................. 21  \n3.8 Visibility ....................................................... 22  \n3.9 Inheritance ...................................................... 22  \n3.10 Multiple inheritance .................................................. 24  \n3.11 Inheritance and composition ............................................. 25  \n3.12 Encapsulation ..................................................... 26  \n3.13 Final classes and methods ............................................... 27  \n3.14 Download the Source Code .............................................. 27  \n3.15 What's next ...................................................... 27  \n4 How and when to use Generics 28  \n4.1 Introduction ...................................................... 28  \n4.2 Generics and interfaces ................................................ 28  \n4.3 Generics and classes ................................................. 29  \n4.4 Generics and methods ................................................. 29  \n4.5 Limitation of generics ................................................. 30  \n4.6 Generics, wildcards and bounded types ........................................ 31  \n4.7 Generics and type inference .............................................. 32  \n4.8 Generic","cbCaifQVs58uzUXA","https://ap.wps.com/l/cbCaifQVs58uzUXA","pdf",893740,124,"English","# Contents\n## How to create and destroy objects\n## Using methods common to all objects\n## How to design Classes and Interfaces\n## How and when to use Generics\n## How and when to use Enums and Annotations\n## How to write methods efﬁciently","[{\"question\":\"What topics are covered in the section “How to create and destroy objects”?\",\"answer\":\"It covers instance construction, implicit and explicit constructors, initialization blocks, construction guarantees, visibility, garbage collection, finalizers, static initialization, and common construction patterns like Singleton, Utility/Helper, Factory, and Dependency Injection.\"},{\"question\":\"Which common methods for all objects does the document address?\",\"answer\":\"It discusses equals and hashCode, toString, clone, and the relationship between equals and the == operator, along with useful helper classes.\"},{\"question\":\"How does the document guide the use of generics, enums, and annotations?\",\"answer\":\"It explains when and how to use generics, including interfaces/classes/methods, limitations, wildcards and bounded types, type inference, and annotations related to generics. It separately details enums and annotations, including special enum behavior, convenient enum methods, specialized collections (EnumSet/EnumMap), and annotation retention, element types, inheritance, repeatability, processors, and guidance on when to use them.\"}]","Advanced java - Part 1 - How to create and destroy objects | PDF",1790069260,312,13,[149,153,157,161,165,169,173,177,181,185,189,194,199],{"page_no":22,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/4c6bf6215dcd8b7d512948e76ba7aedd.webp",983,1390,{"page_no":26,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/7d3f67e2fba7778712bfd4b4ab3133a1.webp",982,1388,{"page_no":30,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/7789cb2df07d756c3da0848f18e0998c.webp",981,1387,{"page_no":33,"url":162,"width":163,"height":164},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/b7b7631bae02a9a4d928c9ed6e23daf5.webp",980,1385,{"page_no":97,"url":166,"width":167,"height":168},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/2578ec7b34187f93b7dc429c90ae6525.webp",979,1384,{"page_no":102,"url":170,"width":171,"height":172},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/f0898cc7c59825c0128f0ba11f96332e.webp",978,1383,{"page_no":106,"url":174,"width":175,"height":176},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/88a6f5b597c2acd13dead17ee61a3da9.webp",977,1381,{"page_no":111,"url":178,"width":179,"height":180},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/32723d91c7a16f501796c338e4f15e62.webp",976,1380,{"page_no":116,"url":182,"width":183,"height":184},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/c0dfef9d15c18aae0efb5ee3d9c14b62.webp",975,1378,{"page_no":124,"url":186,"width":187,"height":188},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/2cbdc1203b11d36dbdba504b813043c9.webp",974,1377,{"page_no":190,"url":191,"width":192,"height":193},11,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/746942b047f544c964fcdc82edbf3545.webp",973,1376,{"page_no":195,"url":196,"width":197,"height":198},12,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/10cacf14575971047e75631cefca56b4.webp",972,1374,{"page_no":147,"url":200,"width":201,"height":202},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/36da32fab29b4e878f30a6444c111218.webp",971,1373]