[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-697919-105":59,"doc-detail-697919-en":134,"doc-similar-697919":165},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":127,"head_meta":129,"extra_data":131,"updated_unix":133},105,"en","java-essentials-object-oriented-design-iv1350","Java Essentials - Object-Oriented Design, IV1350","","Java Essentials - Object-Oriented Design, IV1350 provides an introductory, example-driven overview of core object-oriented concepts in Java. It covers when to use arrays versus java.util.List, including generic lists and for-each iteration. It explains what objects and classes represent, introduces static usage constraints, and demonstrates object creation with new. It further details constructors, parameter passing, the meaning of this, multiple constructors, references, and how exceptions alter control flow through try/catch.",{"@graph":69,"@context":126},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/java-essentials-object-oriented-design-iv1350/697919/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/java-essentials-object-oriented-design-iv1350/697919.png","ImageObject",300,407,{"name":92,"@type":93},"dbqoiu","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-18","2026-11-12",true,{"@type":102,"interactionType":103,"userInteractionCount":19},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118,122],{"name":109,"@type":110,"acceptedAnswer":111},"How do arrays differ from List in Java, and when should each be used?","Question",{"text":112,"@type":113},"Use an array when the number of elements is fixed and known. Use a java.util.List when the number of elements is not fixed or known.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What does a constructor do, and how are initial values assigned to fields?",{"text":117,"@type":113},"A constructor provides initial values to newly created objects. The passed parameters are saved into the object's fields, as shown with acctNo and balance.",{"name":119,"@type":110,"acceptedAnswer":120},"What role does the variable this play in a Java class?",{"text":121,"@type":113},"this always refers to the current object. It distinguishes field access (e.g., this.balance) from constructor parameter names (e.g., balance).",{"name":123,"@type":110,"acceptedAnswer":124},"How does throwing an exception change execution flow?",{"text":125,"@type":113},"When a method throws an exception, execution is interrupted and continues in the catch block of the calling method. The example shows that code after the throw is skipped and control moves to catch.","https://schema.org",{"og:url":83,"og:type":128,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":130,"canonical":83},"index,follow",{"doc_id":132,"site_id":62},697919,1794445821,{"code":4,"msg":5,"data":135},{"doc_id":132,"user_id":136,"nickname":92,"user_avatar":137,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":138,"file_id":139,"file_url":140,"file_type":141,"file_size":142,"view_count":19,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":44,"language":143,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":144,"faqs":145,"seo_title":146,"seo_description":67,"update_tm":133,"read_time":147,"preview_page_count":19,"preview_urls":148},3985747862462,"https://ap-avatar.wpscdn.com/davatar_3d24733baf745e90a7e4bdd5f77d97b2","Java Essentials  \nObject-Oriented Design, IV1350  \nContents  \nContents  \n1 Arrays and Lists 1  \n2 Objects 2  \n3 Constructors 3  \n4 References 4  \n5 Exceptions 5  \n6 Javadoc 6  \n7 Annotations 6  \n8 Interfaces 6  \n9 Inheritance 7  \n1 Arrays and Lists  \nArray  \nAn array is appropriate if the number of elements is ﬁxed and known.  \nint [] myArray = new int [5];  \nList  \n􀀏 It is better to use a java .util .List if the number of elements is not both ﬁxed and known.  \n1 import java.util.ArrayList;  \n2 import java.util.List; 3  \n4 public class Lists {  \n5 public static void main(String[] args) {  \n6 List myList = new ArrayList();  \n7 myList .add(\"Hej\");  \n8 myList .add(3); 9 }  \n10 }  \n􀀏 A List can contain objects of any class, this example stores a String (line 7) and an Integer (line 8) .  \nGeneric List  \n􀀏 The list content can be restricted to objects of one speciﬁc class.  \n– Adding \u003CString> on line six speciﬁes that the list may only contain String objects.  \n– Adding \u003C> on line seven speciﬁes that this holds also for the created ArrayList.  \n1 import java.util.ArrayList;  \n2 import java.util.List; 3  \n4 public class Lists {  \n5 public static void main(String[] args) {  \n6 List\u003CString> myList =  \n7 new ArrayList\u003C>();  \n8 myList .add(\"Hej\");  \n9 myList .add(\"Hopp\"); 10 }  \n11 }  \nGeneric List (Cont'd)  \n􀀏 A generic list can be iterated using a for-each loop, see lines 11-13 .  \n1 import java.util.ArrayList;  \n2 import java.util.List; 3  \n4 public class Lists {  \n5 public static void main(String[] args) {  \n6 List\u003CString> myList =  \n7 new ArrayList\u003C>();  \n8 myList .add(\"Hej\");  \n9 myList .add(\"Hopp\");  \n10  \n11 for(String value : myList) {  \n12 System .out .println(value); 13 }  \n14 } 15 }  \n2 Objects  \nWhat is an Object?  \n􀀏 The goal of object-oriented programming is to declare classes that group data and methods operating on that data.  \n􀀏 A class represents an abstraction, for example person. An object of the class represents a speciﬁc instance of the class, for example the person you.  \nCode Example  \n􀀏 Create project in NetBeans  \n􀀏 Create class  \nUse static Very Restrictively  \n􀀏 Static ﬁelds are shared by all objects of the class.  \n􀀏 If for example the account balance was static, all accounts would have the same balance. Such a program would be useless.  \n􀀏 Since ﬁelds can not be static, neither can methods since static methods can only access static ﬁelds.  \n􀀏 Static ﬁelds and methods are normally not used at all, except in few very special cases.  \nCreating New Objects  \nWhenever we want to create a new account, we create a new object of the Account class. This is done with the operator new.  \nAccount acct = new Account(1234567, 100);  \nCode Example  \n􀀏 Create an Account object and use it  \n􀀏 Demonstrate the debugger  \n3 Constructors  \nProviding Initial Values  \n􀀏 The constructor is used to provide initial values to newly created objects.  \n1 public class Account {  \n2 private long acctNo;  \n3 private int balance; 4  \n5 public Account(long acctNo, int balance) {  \n6 this .acctNo = acctNo;  \n7 this .balance = balance; 8 }  \n9 //The methods are not showed.  \n10 }  \n􀀏 The values passed to the constructor are saved in the object's ﬁelds on lines 6 and 7 .  \n􀀏 Sending parameters to a constructor is just like sending parameters to a method.  \nCalling the Constructor  \nAccount acct = new Account(1234567, 100);  \n􀀏 The constructor is invoked when an new object is created.  \n􀀏 Parameters are passed to the constructor just the same way parameters are passed when an ordinary method is called.  \nThe Variable this  \nThe variable this always refers to the current object.  \n1 public class Account {  \n2 private long acctNo;  \n3 private int balance; 4  \n5 public Account(long acctNo, int balance) {  \n6 this .acctNo = acctNo;  \n7 this .balance = balance; 8 }  \n􀀏 Lines 6 and 7 illustrate the use of this.  \n􀀏 this .balance on line 7 refers to the ﬁeld declared on line 3 .  \n􀀏 balance on line 7 refers to the constructor parameter declared on l","cbCaikhpaNpbNy7A","https://ap.wps.com/l/cbCaikhpaNpbNy7A","pdf",110545,"English","# Arrays and Lists\n## Objects\n## Constructors\n## References\n## Exceptions\n## Javadoc\n## Annotations\n## Interfaces\n## Inheritance","[{\"question\":\"How do arrays differ from List in Java, and when should each be used?\",\"answer\":\"Use an array when the number of elements is fixed and known. Use a java.util.List when the number of elements is not fixed or known.\"},{\"question\":\"What does a constructor do, and how are initial values assigned to fields?\",\"answer\":\"A constructor provides initial values to newly created objects. The passed parameters are saved into the object's fields, as shown with acctNo and balance.\"},{\"question\":\"What role does the variable this play in a Java class?\",\"answer\":\"this always refers to the current object. It distinguishes field access (e.g., this.balance) from constructor parameter names (e.g., balance).\"},{\"question\":\"How does throwing an exception change execution flow?\",\"answer\":\"When a method throws an exception, execution is interrupted and continues in the catch block of the calling method. The example shows that code after the throw is skipped and control moves to catch.\"}]","Java Essentials - Object-Oriented Design, IV1350 | PDF",23,[149,153,157,161],{"page_no":8,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/213a4d27501a66aca32bf21eec3300f0.webp",983,1390,{"page_no":14,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/404659c91de2b0ff0dad87204d99eccb.webp",982,1388,{"page_no":81,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/aea022c21a3804a06351fc7576259f7f.webp",981,1387,{"page_no":19,"url":162,"width":163,"height":164},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/1a2bafed21151083237826378c1bf043.webp",980,1385,{"list":166,"token":66},[167,174,181,187,194,200,206,212,218,224],{"doc_id":168,"doc_title":169,"file_type":141,"home_preview_img_url":170,"slug":171,"view_count":172,"category_name":30,"create_tm":173},347826,"Advanced java - Part 1 - How to create and destroy objects","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911558162/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=5Wban2Rw0%2FnmM6e4KUz76JJw98A%3D","advanced-java-part-1-how-to-create-and-destroy-objects",14,1790069260,{"doc_id":175,"doc_title":176,"file_type":141,"home_preview_img_url":177,"slug":178,"view_count":179,"category_name":30,"create_tm":180},718169,"Core-java-material","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230018614171/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=CVVUBqPtvSEBtvMGlPo7hlW1Z18%3D","core-java-material",15,1794855126,{"doc_id":182,"doc_title":183,"file_type":141,"home_preview_img_url":184,"slug":185,"view_count":24,"category_name":30,"create_tm":186},697921,"Java Collections Framework - Interfaces, Implementations, and Core Algorithms","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010131024/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=VBJpfWxOLVvRAsncU0xsifUmDaM%3D","java-collections-framework-interfaces-implementations-and-core-algorithms",1794445828,{"doc_id":188,"doc_title":189,"file_type":141,"home_preview_img_url":190,"slug":191,"view_count":192,"category_name":30,"create_tm":193},423014,"THE JAVA LANGUAGE CHEAT SHEET - quick reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229922611453/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=LclveDI5uTKbTnj6lSP5hCOmSeo%3D","the-java-language-cheat-sheet-quick-reference",13,1790629749,{"doc_id":195,"doc_title":196,"file_type":141,"home_preview_img_url":197,"slug":198,"view_count":19,"category_name":30,"create_tm":199},685664,"General C# Cheat Sheet - Quick reference guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000173279/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=Hfm6p%2BanjXa0wgxzY4N5rU7SIoA%3D","general-c-cheat-sheet-quick-reference-guide",1794016366,{"doc_id":201,"doc_title":202,"file_type":141,"home_preview_img_url":203,"slug":204,"view_count":39,"category_name":30,"create_tm":205},655925,"UML Diagram Key - Basics","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229975294431/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=BQHU13j%2BXgew1%2B5Hcab1p%2BMkGgM%3D","uml-diagram-key-basics",1792964949,{"doc_id":207,"doc_title":208,"file_type":141,"home_preview_img_url":209,"slug":210,"view_count":179,"category_name":30,"create_tm":211},347821,"JAVA - A Beginner’s Guide to Learning the Basics of Java Programming","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911558006/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=OZtc6SWQ1i5slcsiGSU6oqyXqWc%3D","java-a-beginners-guide-to-learning-the-basics-of-java-programming",1790069246,{"doc_id":213,"doc_title":214,"file_type":141,"home_preview_img_url":215,"slug":216,"view_count":46,"category_name":30,"create_tm":217},347822,"Introduction to Programming Using Java - Version 9 - Swing Edition","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911558026/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=pR%2BTHM%2BmhRJMKgC8podwushCsf4%3D","introduction-to-programming-using-java-version-9-swing-edition",1790069250,{"doc_id":219,"doc_title":220,"file_type":141,"home_preview_img_url":221,"slug":222,"view_count":29,"category_name":30,"create_tm":223},670910,"Fourth AP Edition - Object-Oriented Programming and Data Structures - Preface xiii","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988353200/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=TEtnCTeCRoGmEPawUhZ2CTbSkqA%3D","fourth-ap-edition-object-oriented-programming-and-data-structures-preface-xiii",1793572671,{"doc_id":225,"doc_title":226,"file_type":141,"home_preview_img_url":227,"slug":228,"view_count":229,"category_name":30,"create_tm":230},347076,"Core Java - Volume 1 - Twelfth Edition","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229910997667/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114279&Signature=dCDy%2FybDt6FwYqCNVrQtxo27jGk%3D","core-java-volume-1-twelfth-edition",31,1790065168]