[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-685787-105":59,"doc-detail-685787-en":130,"doc-similar-685787":161},{"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":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","arrays-java-arrays-vs-python-lists-learn-how-to-declare-and-use-arrays-in-java","Arrays - Java Arrays vs Python Lists - Learn how to declare and use arrays in Java","","Arrays are described as a fundamental data structure for storing sequences of same-type values, highlighting elements, indexing, and common uses such as collecting statistics and representing game state. The material contrasts Java arrays with Python lists, focusing on fixed versus dynamic size and type consistency. It explains how arrays are objects in Java, the two-step process of declaring and instantiating, example syntax for primitives and object arrays, default values, memory allocation, and how to assign initial values via initializer lists.",{"@graph":69,"@context":122},[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/arrays-java-arrays-vs-python-lists-learn-how-to-declare-and-use-arrays-in-java/685787/",{"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/arrays-java-arrays-vs-python-lists-learn-how-to-declare-and-use-arrays-in-java/685787.png","ImageObject",300,407,{"name":92,"@type":93},"Đào","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-10","2026-11-07",true,{"@type":102,"interactionType":103,"userInteractionCount":81},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What is an array and how is it structured?","Question",{"text":112,"@type":113},"An array stores a sequence of values of the same type. Each value is an element, and an index specifies each element’s position.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How do Java arrays differ from Python lists?",{"text":117,"@type":113},"Java arrays have a fixed size, and all elements must be the same type. Python lists can change size, can hold multiple types, and allow operations such as inserting and concatenating.",{"name":119,"@type":110,"acceptedAnswer":120},"What are the steps to use arrays in Java?",{"text":121,"@type":113},"Creating an array involves declaring a reference and then instantiating the array. After instantiation, the array holds elements in consecutive memory and elements receive default values by type.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},685787,1794018478,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":81,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":129,"read_time":144,"preview_page_count":19,"preview_urls":145},1374402968488,"https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0","Arrays:  \n• An array is a data structure that stores a sequence of values of the same type.  \n• The data type can be any of Java’s primitive types:  \n• int, short, byte, long, float, double, boolean, char  \n• The data type can also be any class:  \n• String, SolidBoxes, etc.  \n• Each variable in the array is an element.  \n• An index specifies the position of each element in the array.  \n• Useful for many applications:  \n• Collecting statistics.  \n• Representing the state of a game.  \n• Etc.  \nJava Arrays vs Python Lists:  \n• The closest structure to an array in Python is the List, but there are many differences.  \n• An array has a fixed size but the size of a Python List can change.  \n• All the elements of an array must be the same type, but a Python List can have elements of many types.  \n• You may insert into the middle of a Python List, but not into an array  \n• You may concatenate a Python List, but not an array  \n• Why would we even have something like an array when a list is so much more flexible?  \n• Answer: Nothing is free. Arrays are more efficient than lists.  \nArrays  \n• Arrays are one of the oldest and most basic data structures in computer science.  \n• Many implementations of arrays use a block of contiguous memory  \nBlock of integers in memory  \n• It is the most efficient way to store a collection of a known number of items.  \n| 3432 |\n| --- |\n| 3 |\n| 54 |\n| -434 |\n| 324 |\n| 234 |\n| 4 |\n| 80948 |\n\n• It also allows random access of items. (Through an index)  \n• In Java, arrays are objects so they contain more information, but the data is stored in consecutive memory.  \nDeclaring and Instantiating Arrays:  \n• Arrays are objects.  \n• Creating an array requires two steps:  \n1. Declaring the reference to the array  \n2. Instantiating the array.  \n• To declare a reference to the array:  \ndatatype [] arrayName ;  \n• To instantiate an array:  \narrayName = new datatype[ size ];  \nint [] zapNumbers ;  \nzapNumbers = new int [ 173 ];  \nfloat [] grades;  \ngrades = new float[ 22 ] ;  \nString [] names;  \nnames = new String[ 20 ];  \n• size is an int and is the number of elements that will be in the array.  \n• Examples:  \n• Declaring and instantiating arrays of primitive types:  \ndouble [] dailyTemps ; // elements are doubles  \ndailyTemps = new double[ 365 ]; // 365 elements  \nboolean [] answers; // elements are booleans: true, false  \nanswers = new boolean [ 20 ]; // 20 elements  \nint [] cs127A, cs252; // two arrays, each containing integers  \ncs127A = new int [ 310 ]; // 310 elements for cs127A  \ncs252 = new int [ 108 ]; // 108 elements for cs252  \n• Declaring and instantiating arrays of objects:  \nString [] cdTracks ; // each element is a String  \ncdTracks = new String[ 15 ]; // 15 elements to hold song names  \nBaseballStats [] myTeam; // BaseballStats is a user defined class  \nmyTeam = new BaseballStats [ 25 ]; // 25 players on my team  \n• The declaration and instantiation can be done in the same step.  \ndouble [] dailyTemps = new double[ 365 ];  \n... can now use the dailyTemps array in my code ...  \ndailyTemps = new double[ 173 ];  \n... can now use the new size of dailyTemps array in my code ...  \nint numberOfQestions = 30;  \nboolean [] answers = new boolean [ numberOfQuestions ];  \nint [] cs127 = new int [ 240 ], cs252 = new int [ 75 ];  \nString [] studentNames = new String[ 42 ];  \nint numPlayers = 25;  \nint numTeams = 10;  \nBaseballStats [] myTeam = new BaseballStats [ numPlayers * numTeams ];  \n• When an array is instantiated, the elements are assigned default values as follows:  \n\n| \u003Cbr>Array data type | \u003Cbr>Default value |\n| --- | --- |\n| byte, short, int, long | 0 |\n| float, double | 0 |\n| char | nul character |\n| boolean | false |\n| Any object reference (for example, a\u003Cbr>String) | null |\n\n• The instantiation of an array creates an area of memory that holds the elements of the array.  \n• This area of memory has one name, the name of the array.  \ndouble [] zapNums = new double[ 5 ];  \nint numberOfQuestions = 4;  \nboolea","cbCaidOVScMRsKVL","https://ap.wps.com/l/cbCaidOVScMRsKVL","pdf",743002,33,"English","# Arrays\n## Array basics: elements, type, index, uses\n## Java Arrays vs Python Lists\n## Declaring and instantiating arrays in Java\n## Default values and memory allocation\n## Assigning initial values to arrays","[{\"question\":\"What is an array and how is it structured?\",\"answer\":\"An array stores a sequence of values of the same type. Each value is an element, and an index specifies each element’s position.\"},{\"question\":\"How do Java arrays differ from Python lists?\",\"answer\":\"Java arrays have a fixed size, and all elements must be the same type. Python lists can change size, can hold multiple types, and allow operations such as inserting and concatenating.\"},{\"question\":\"What are the steps to use arrays in Java?\",\"answer\":\"Creating an array involves declaring a reference and then instantiating the array. After instantiation, the array holds elements in consecutive memory and elements receive default values by type.\"}]","Arrays - Java Arrays vs Python Lists - Learn how to declare and use arrays in Java | PDF",83,[146,150,153,157],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/6b0fc907a6bf1ee7098809a487b6e5fc.webp",983,655,{"page_no":14,"url":151,"width":152,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/118d2565513cc0f9f8e85dda2452a96a.webp",982,{"page_no":81,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/0431428e66e0349514e7dec4892f0a67.webp",981,654,{"page_no":19,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/654e3d66c0270dc6074bfdc03ce091f8.webp",980,653,{"list":162,"token":66},[163,169,174,180,186,192,198,204,210,216],{"doc_id":164,"doc_title":165,"file_type":137,"home_preview_img_url":166,"slug":167,"view_count":19,"category_name":30,"create_tm":168},685688,"Lecture 11 - Arrays and ArrayLists - Introduction","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000179281/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=o1KOSCG1WOKUzReqOScR8SkYo1Y%3D","lecture-11-arrays-and-arraylists-introduction",1794016761,{"doc_id":170,"doc_title":171,"file_type":137,"home_preview_img_url":172,"slug":173,"view_count":34,"category_name":30,"create_tm":129},685788,"Python Arrays - Learn How to Create, Access, and Modify Lists","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999694760/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=pzSbdTc6k3CtVEFc96CuvNFNlUU%3D","python-arrays-learn-how-to-create-access-and-modify-lists",{"doc_id":175,"doc_title":176,"file_type":137,"home_preview_img_url":177,"slug":178,"view_count":19,"category_name":30,"create_tm":179},685785,"Arrays and Array Lists - Enhanced for Loop and 2D Arrays","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000208921/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=Fus8PebzAPfhG1Eve6wLpBgD7Ns%3D","arrays-and-array-lists-enhanced-for-loop-and-2d-arrays",1794018474,{"doc_id":181,"doc_title":182,"file_type":137,"home_preview_img_url":183,"slug":184,"view_count":29,"category_name":30,"create_tm":185},685629,"Chapter 2: Lists, Arrays and Dictionaries","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999084017/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=GlBC3R05UpvR3tVMmLrdAKl%2BGuM%3D","chapter-2-lists-arrays-and-dictionaries",1794016092,{"doc_id":187,"doc_title":188,"file_type":137,"home_preview_img_url":189,"slug":190,"view_count":24,"category_name":30,"create_tm":191},685805,"Numpy - Array - Chapter 11 - Informatics Practices","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000213217/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=RrhKrCgGDy02WjOVDoQ1YIdI7ME%3D","numpy-array-chapter-11-informatics-practices",1794018711,{"doc_id":193,"doc_title":194,"file_type":137,"home_preview_img_url":195,"slug":196,"view_count":19,"category_name":30,"create_tm":197},685795,"Tutorial - Arrays and ArrayList - Introduction and Examples","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000212503/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=NJsKjITEZU3zz%2FcbFuIVrVnMVVQ%3D","tutorial-arrays-and-arraylist-introduction-and-examples",1794018675,{"doc_id":199,"doc_title":200,"file_type":137,"home_preview_img_url":201,"slug":202,"view_count":29,"category_name":30,"create_tm":203},697978,"Lecture 4: Tuples, List Slicing, List Comprehension, Strings","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146771/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=uwlDRd5FTs%2BhKMZsuIQEYlVgaPw%3D","lecture-4-tuples-list-slicing-list-comprehension-strings",1794446559,{"doc_id":205,"doc_title":206,"file_type":137,"home_preview_img_url":207,"slug":208,"view_count":19,"category_name":30,"create_tm":209},685627,"List in Python - A Beginner Guide -","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000169755/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=4ym%2FovsFpNeXFCLanfIMZZxUOEY%3D","list-in-python-a-beginner-guide",1794016087,{"doc_id":211,"doc_title":212,"file_type":137,"home_preview_img_url":213,"slug":214,"view_count":19,"category_name":30,"create_tm":215},697965,"Arrays Made Easy - An Introduction to Arrays and Array Processing - SUGI 30 Tutorials","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146275/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=TrUdztX9lzLecqmFDaa2Dpx6NqI%3D","arrays-made-easy-an-introduction-to-arrays-and-array-processing-sugi-30-tutorials",1794446535,{"doc_id":217,"doc_title":218,"file_type":137,"home_preview_img_url":219,"slug":220,"view_count":34,"category_name":30,"create_tm":221},685771,"Compound Data - Lists, Tuples, Dictionaries - Unit IV - Learning Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203726/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=iDy6a5Tq77gGmPRh5YN76FdkKLw%3D","compound-data-lists-tuples-dictionaries-unit-iv-learning-notes",1794018217]