{"id":19161,"date":"2020-07-07T05:06:03","date_gmt":"2020-07-07T12:06:03","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19161"},"modified":"2023-12-01T03:53:16","modified_gmt":"2023-12-01T11:53:16","slug":"java-array","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/java-array\/","title":{"rendered":"Java Array: A Guide for Beginners"},"content":{"rendered":"\n<p>What if there was a way that you could declare one variable that stores multiple values? There is? That&#8217;s great. In Java, there&#8217;s a concept called an array that allows you to do exactly this. You can store multiple values in one variable, which helps keep your code clean and tidy.<br><\/p>\n\n\n\n<p>In this guide, we&#8217;re going to discuss how arrays work, why they are used, and how you can manipulate the contents of an array. We&#8217;ll walk through a few examples to show how they work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Is an Array?<\/h2>\n\n\n\n<p>An array, also known as a list, is a data structure that contains an ordered sequence of elements. You can store zero or more items in an array, but they all have to be the same type. For instance, an array could store one-hundred strings or fifty-two numbers.<br><\/p>\n\n\n\n<p>Arrays are useful because they help you group similar values together. Let&#8217;s say you are defining an array of coffee types. Rather than declaring each type of coffee as its own variable, you could group them together in an array.<br><\/p>\n\n\n\n<p>Once you&#8217;ve declared an array, you can perform the same methods and operations on every value in the array by iterating through it.&nbsp;<br><\/p>\n\n\n\n<p>One way to think about arrays is as a collection of values. You know that to-do list that you need to get through today? That&#8217;s similar to an array. There&#8217;s a list of tasks that you need to get through, and each one is stored in a particular order.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Declaring an Array<\/h2>\n\n\n\n<p>Declaring an array in Java is simple. All you&#8217;ve got to do is choose a name for your array and specify its data type. Here&#8217;s an example of declaring an array called <code>coffees<\/code>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>String[] coffees;<\/pre><\/div>\n\n\n\n<p>Our code creates an array called <code>coffees<\/code>. On the left, you have the type of data which will be stored in your array. You also have a pair of empty brackets. This tells you code that you want to define an array, rather than just a string variable. On the right, you&#8217;ve got the name of the variable.&nbsp;<br><\/p>\n\n\n\n<p>We&#8217;re not quite done yet. When you&#8217;re declaring an array, you&#8217;ve got to tell your program how many items you want your array to hold. This allows Java to allocate the memory necessary to store values in your array.<br><\/p>\n\n\n\n<p>We want our <code>coffees<\/code> array to store our three favorite blends at our local shop. To do this, we&#8217;ll tell our program that the number of elements our array should be able to hold is three:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>coffees = new String[3];<\/pre><\/div>\n\n\n\n<p>This will create three empty values which can be filled in our array.<br><\/p>\n\n\n\n<p>Make sure that you think about how many values you want to store in your array. It&#8217;s important to note that once you&#8217;ve defined the size of an array variable, it cannot be changed.&nbsp;<br><\/p>\n\n\n\n<p>We can compress our code down into one line where we both declare an array and allocate memory:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>String[] coffees = new String[4];<\/pre><\/div>\n\n\n\n<p>This is the best way to declare an array because it&#8217;s concise and simple. The only occasion where this method doesn&#8217;t work is when you&#8217;re not sure how many values you are going to store in your array. If this is the case, you&#8217;d probably want to declare an array first, then allocate memory once your program knows how many values will store.<br><\/p>\n\n\n\n<p>In this case, our array will hold string values. However, you could also declare an array of integers, an array of objects, an array of arrays, or an array holding another data type.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Initializing an Array<\/h2>\n\n\n\n<p>We&#8217;re not quite done yet with setting up our array. So far, we&#8217;ve declared a standard array. The trouble is that it doesn&#8217;t hold any values yet. The syntax for assigning a set of initial values to an array while declaring a variable is:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>String[] coffees = { \"Rwanda Izuba\", \"French Roast\", \"Vietnam Da La Arabica\" };<\/pre><\/div>\n\n\n\n<p>In this example, we&#8217;ve assigned three values to our array.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Accessing the Elements in an Array<\/h2>\n\n\n\n<p>The beauty of arrays is that they&#8217;re easy to access. Metaphorically, it&#8217;s just like circling an item on your to-do list that you want to focus on.&nbsp;<br><\/p>\n\n\n\n<p>Inside an array, every item is given its own special number. These are called index numbers. Index numbers start at the number 0, and they increase by 1 for each item in your array. Consider the following list:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>0: Rwanda Izuba<\/li>\n\n\n\n<li>1: French Roast<\/li>\n\n\n\n<li>2: Vietnam Da Lat Arabica<\/li>\n<\/ul>\n\n\n\n<p>In this list, the Rwanda Izuba blend would have an index value of 0, the French Roast blend would have an index value 1, and the Vietnam Da Lat Arabica blend would have an index value of 2. Let&#8217;s take the following array:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>String[] coffees = { \"Rwanda Izuba\", \"French Roast\", \"Vietnam Da La Arabica\" };<\/pre><\/div>\n\n\n\n<p>If you want to access the first item in this array, you could use this code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>System.out.println(coffees[0]);<\/pre><\/div>\n\n\n\n<p>Our code returns: Rwanda Izuba.<br><\/p>\n\n\n\n<p>The index value is passed into your array between square brackets. The range of numbers that exist as index values is between 0 and one less than the length of your array. This is because, as we mentioned earlier, arrays are indexed from the value 0.<br><\/p>\n\n\n\n<p>If you try to access an index value that doesn&#8217;t exist, an error is returned:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3<\/pre><\/div>\n\n\n\n<p>In this case, we tried to access index value 3 in our array. Because our index values only go up to two\u2014remember, arrays are indexed starting from 0\u2014an error was returned.&nbsp;<br><\/p>\n\n\n\n<p>Let&#8217;s take it up a notch. Suppose that you want to go through every item in your array and perform an operation on them individually. We&#8217;re going to print every item in our array to the console. You can accomplish this using a for-each loop, like this:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class CoffeeArray {\n   \tpublic static void main(String[] args) {\nString[] coffees = { \"Rwanda Izuba\", \"French Roast\", \"Vietnam Da La Arabica\" };\nfor (String coffee : coffees) {\n\tSystem.out.println(coffee);\n}\n\t}\n}<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Rwanda Izuba\nFrench Roast\nVietnam Da La Arabica<\/pre><\/div>\n\n\n\n<p>In this example, our code iterates through every item in our <code>coffees<\/code> array and prints out each item to the console. We&#8217;ve used a for-each loop instead of a &#8220;for&#8221; loop because it doesn&#8217;t require a counter, which means it is more concise and easier to read.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Changing Items in an Array<\/h2>\n\n\n\n<p>Houston, we have a problem. It turns out that our favorite French blend is not actually called French Roast. It&#8217;s called French Classic. If we want to change this, we can use indexing.<br><\/p>\n\n\n\n<p>Consider the following code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class CoffeeArray {\n   \tpublic static void main(String[] args) {\nString[] coffees = { \"Rwanda Izuba\", \"French Roast\", \"Vietnam Da La Arabica\" };\ncoffees[1] = \"French Classic\";\nSystem.out.println(coffees[1]);\n\t}\n}<\/pre><\/div>\n\n\n\n<p>We&#8217;ve used the assignment operator (=) to change the value of our coffee which exists at index position 1. We&#8217;ve changed its value from <code>French Roast<\/code> to <code>French Classic<\/code>. Our code returns: French Classic.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Java Array: An Example<\/h2>\n\n\n\n<p>Let&#8217;s bring together all of the concepts we&#8217;ve discussed in one example. Let&#8217;s say that we want to calculate how much we&#8217;ve spent on coffees in total over the last week.<br><\/p>\n\n\n\n<p>First, we&#8217;re going to set up the class and the variables for our program:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class CoffeePrices {\n   \tpublic static void main(String[] args) {\n\t\tDouble[] purchases = {2.55, 2.75, 2.99, 3.05};\n\t\tdouble sum = 0;\n\t}\n}<\/pre><\/div>\n\n\n\n<p>We&#8217;ve declared two variables. One variable stores our list of purchases. The next variable stores a counter of how much we&#8217;ve spent on coffee. Our next step is to create a for-each loop which loops through every coffee purchase and adds it to our &#8220;sum&#8221; variable:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>for (double purchase : purchases) {\nsum += purchase;\n}<\/pre><\/div>\n\n\n\n<p>If we run our code, our program will calculate the total amount we&#8217;ve spent on coffees in the last week. There&#8217;s only one problem: our program doesn&#8217;t tell us what that value is! We can retrieve the value by printing it out to the console:<br><\/p>\n\n\n\n<p>When we run all of this code together, the following is returned:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>You've spent $11.34 on coffee in the last week.\n$11.34 on coffee. Not bad! What a useful program.<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<iframe loading=\"lazy\" frameborder=\"0\" width=\"100%\" height=\"400px\" src=\"https:\/\/repl.it\/@careerkarma\/Java-Arrays?lite=true\"><\/iframe>\n<br>\n<br>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion (and Challenge)<\/h2>\n\n\n\n<p>Arrays are a type of data that can store multiple values of the same data type. You could declare an array for anything, such as a list of your favorite books, a list of players in a game, or a list of numbers of which you want to calculate the average.<br><\/p>\n\n\n\n<p>Are you looking for a challenge? Read on.<br><\/p>\n\n\n\n<p>Write a program that asks a user to select a travel destination to find out more about. You should store the travel destinations in an array. You should store a one-sentence description of each destination in a separate array.<br><\/p>\n\n\n\n<p>When a user chooses a travel destination, find it in your array of travel destinations, and calculate its index number. Then, use that index number to print out the one-sentence description of the corresponding destination to the console.<br><\/p>\n\n\n\n<p>Now you&#8217;re ready to start using arrays in Java like a professional!<br><\/p>\n","protected":false},"excerpt":{"rendered":"What if there was a way that you could declare one variable that stores multiple values? There is? That's great. In Java, there's a concept called an array that allows you to do exactly this. You can store multiple values in one variable, which helps keep your code clean and tidy. In this guide, we're&hellip;","protected":false},"author":240,"featured_media":19162,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17289],"tags":[],"class_list":{"0":"post-19161","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-java"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Java","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Java Array: A Guide for Beginners | Career Karma<\/title>\n<meta name=\"description\" content=\"Arrays are a data type that allows you to store multiple values. On Career Karma, learn how to declare an array and modify and access their contents.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/java-array\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Array: A Guide for Beginners\" \/>\n<meta property=\"og:description\" content=\"Arrays are a data type that allows you to store multiple values. On Career Karma, learn how to declare an array and modify and access their contents.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/java-array\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-07T12:06:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:53:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"663\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Java Array: A Guide for Beginners\",\"datePublished\":\"2020-07-07T12:06:03+00:00\",\"dateModified\":\"2023-12-01T11:53:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/\"},\"wordCount\":1389,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg\",\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/\",\"name\":\"Java Array: A Guide for Beginners | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg\",\"datePublished\":\"2020-07-07T12:06:03+00:00\",\"dateModified\":\"2023-12-01T11:53:16+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Arrays are a data type that allows you to store multiple values. On Career Karma, learn how to declare an array and modify and access their contents.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg\",\"width\":1000,\"height\":663},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-array\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java Array: A Guide for Beginners\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/jamesgallagher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java Array: A Guide for Beginners | Career Karma","description":"Arrays are a data type that allows you to store multiple values. On Career Karma, learn how to declare an array and modify and access their contents.","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:\/\/careerkarma.com\/blog\/java-array\/","og_locale":"en_US","og_type":"article","og_title":"Java Array: A Guide for Beginners","og_description":"Arrays are a data type that allows you to store multiple values. On Career Karma, learn how to declare an array and modify and access their contents.","og_url":"https:\/\/careerkarma.com\/blog\/java-array\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-07T12:06:03+00:00","article_modified_time":"2023-12-01T11:53:16+00:00","og_image":[{"width":1000,"height":663,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/java-array\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/java-array\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Java Array: A Guide for Beginners","datePublished":"2020-07-07T12:06:03+00:00","dateModified":"2023-12-01T11:53:16+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-array\/"},"wordCount":1389,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-array\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg","articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/java-array\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/java-array\/","url":"https:\/\/careerkarma.com\/blog\/java-array\/","name":"Java Array: A Guide for Beginners | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-array\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-array\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg","datePublished":"2020-07-07T12:06:03+00:00","dateModified":"2023-12-01T11:53:16+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Arrays are a data type that allows you to store multiple values. On Career Karma, learn how to declare an array and modify and access their contents.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/java-array\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/java-array\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/java-array\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kelly-sikkema-1_RZL8BGBM-unsplash.jpg","width":1000,"height":663},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/java-array\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/careerkarma.com\/blog\/java\/"},{"@type":"ListItem","position":3,"name":"Java Array: A Guide for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=19161"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19161\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/19162"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}